##// 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
Raphaël Gomès
rust: add PyO3 based Rust extension module...
r53299 use pyo3::prelude::*;
Georges Racinet
rust-pyo3: retrieving the InnerRevlog of hg-cpython...
r53308 mod convert_cpython;
Georges Racinet
rust-pyo3: facility for submodule registration, using it for dagop...
r53304 mod dagops;
Georges Racinet
rust-pyo3: defining GraphError...
r53305 mod exceptions;
Georges Racinet
rust-pyo3: conversion helpers for Revision objects...
r53306 mod revision;
Georges Racinet
rust-pyo3: facility for submodule registration, using it for dagop...
r53304 mod util;
Raphaël Gomès
rust: add PyO3 based Rust extension module...
r53299 #[pymodule]
Georges Racinet
rust-pyo3: facility for submodule registration, using it for dagop...
r53304 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)?)?;
Georges Racinet
rust-pyo3: defining GraphError...
r53305 m.add("GraphError", py.get_type::<exceptions::GraphError>())?;
Raphaël Gomès
rust: add PyO3 based Rust extension module...
r53299 Ok(())
}