2015-05-27 19:19:32 +00:00
|
|
|
#![crate_type = "dylib"]
|
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(interpolate_idents)]
|
|
|
|
|
|
|
|
#[macro_use] extern crate cpython;
|
|
|
|
|
|
|
|
py_module_initializer!(inheritance, |_py, m| {
|
|
|
|
try!(m.add("__doc__", "Module documentation string"));
|
2015-06-24 22:02:56 +00:00
|
|
|
let base_class = try!(
|
2015-05-27 19:19:32 +00:00
|
|
|
m.add_type::<()>("BaseClass")
|
|
|
|
.doc("Type doc string")
|
|
|
|
.finish());
|
|
|
|
for i in 1..10 {
|
|
|
|
try!(
|
|
|
|
m.add_type::<()>(&format!("C{}", i))
|
2015-06-24 22:02:56 +00:00
|
|
|
.base(&base_class)
|
2015-05-27 19:19:32 +00:00
|
|
|
.doc(&format!("Derived class #{}", i))
|
|
|
|
.finish());
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
});
|
|
|
|
|