comparison rust/hg-cpython/src/lib.rs @ 42217:13b64247f48f

rust-discovery: cpython bindings for the core logic As previously done with the ancestors submodule, testing for the bindings is provided from Python on a trivial case. Differential Revision: https://phab.mercurial-scm.org/D6232
author Georges Racinet <georges.racinet@octobus.net>
date Wed, 20 Feb 2019 09:04:39 +0100
parents 0c7b353ce100
children e240bec26626
comparison
equal deleted inserted replaced
42216:10b465d61556 42217:13b64247f48f
26 26
27 pub mod ancestors; 27 pub mod ancestors;
28 mod cindex; 28 mod cindex;
29 mod conversion; 29 mod conversion;
30 pub mod dagops; 30 pub mod dagops;
31 pub mod discovery;
31 pub mod exceptions; 32 pub mod exceptions;
32 33
33 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| { 34 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
34 m.add( 35 m.add(
35 py, 36 py,
38 )?; 39 )?;
39 40
40 let dotted_name: String = m.get(py, "__name__")?.extract(py)?; 41 let dotted_name: String = m.get(py, "__name__")?.extract(py)?;
41 m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?; 42 m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?;
42 m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?; 43 m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?;
44 m.add(py, "discovery", discovery::init_module(py, &dotted_name)?)?;
43 m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?; 45 m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?;
44 Ok(()) 46 Ok(())
45 }); 47 });