##// END OF EJS Templates
rust-pyo3: dagop submodule implementation...
rust-pyo3: dagop submodule implementation This is the first demonstration that the passing of objects through the Python interpreter from `rustext` to `pyo3_rustext` actually works. In the Python tests, we conflate the presence of the `pyo3_rustext` package with that of `rustext`, as we do not plan to support building one and not the other (we hope to convert fully to PyO3 soon). The skipping is actually done by the base test class. The implementation of `rank` is as trivial as it was in `hg-cpython`, yet it required to be able to convert exceptions from `vcsgraph`.

File last commit:

r53308:c2480ac4 default
r53310:20fe0bf9 default
Show More
lib.rs
23 lines | 657 B | application/rls-services+xml | RustLexer
use pyo3::prelude::*;
mod convert_cpython;
mod dagops;
mod exceptions;
mod revision;
mod util;
#[pymodule]
fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add(
"__doc__",
"Mercurial core concepts - Rust implementation exposed via PyO3",
)?;
// the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext
// (at least at this point).
let name: String = m.getattr("__name__")?.extract()?;
let dotted_name = format!("mercurial.{}", name);
m.add_submodule(&dagops::init_module(py, &dotted_name)?)?;
m.add("GraphError", py.get_type::<exceptions::GraphError>())?;
Ok(())
}