##// END OF EJS Templates
rust-pyo3: facility for submodule registration, using it for dagop...
rust-pyo3: facility for submodule registration, using it for dagop It turns out that PyO3 has the exact same problem that we encountered long ago with rust-cpython. The only difference is that the value of `__name__` is not within the `mercurial` package at this point of registration. We reimplement the solution (equivalent to the suggestions in PyO3 issue tracker anyway), this time in a generic module to limit the amount of boilerplate in subsequent applications.

File last commit:

r53304:c5128c54 default
r53304:c5128c54 default
Show More
dagops.rs
22 lines | 597 B | application/rls-services+xml | RustLexer
Georges Racinet
rust-pyo3: facility for submodule registration, using it for dagop...
r53304 // dagops.rs
//
// Copyright 2024 Georges Racinet <georges.racinet@cloudcrane.io>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
//! Bindings for the `hg::dagops` module provided by the
//! `hg-core` package.
//!
//! From Python, this will be seen as `mercurial.pyo3-rustext.dagop`
use pyo3::prelude::*;
use crate::util::new_submodule;
pub fn init_module<'py>(
py: Python<'py>,
package: &str,
) -> PyResult<Bound<'py, PyModule>> {
let m = new_submodule(py, package, "dagop")?;
Ok(m)
}