Show More
@@ -0,0 +1,4 | |||
|
1 | use pyo3::create_exception; | |
|
2 | use pyo3::exceptions::PyValueError; | |
|
3 | ||
|
4 | create_exception!(pyo3_rustext, GraphError, PyValueError); |
@@ -1,19 +1,21 | |||
|
1 | 1 | use pyo3::prelude::*; |
|
2 | 2 | |
|
3 | 3 | mod dagops; |
|
4 | mod exceptions; | |
|
4 | 5 | mod util; |
|
5 | 6 | |
|
6 | 7 | #[pymodule] |
|
7 | 8 | fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { |
|
8 | 9 | m.add( |
|
9 | 10 | "__doc__", |
|
10 | 11 | "Mercurial core concepts - Rust implementation exposed via PyO3", |
|
11 | 12 | )?; |
|
12 | 13 | // the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext |
|
13 | 14 | // (at least at this point). |
|
14 | 15 | let name: String = m.getattr("__name__")?.extract()?; |
|
15 | 16 | let dotted_name = format!("mercurial.{}", name); |
|
16 | 17 | |
|
17 | 18 | m.add_submodule(&dagops::init_module(py, &dotted_name)?)?; |
|
19 | m.add("GraphError", py.get_type::<exceptions::GraphError>())?; | |
|
18 | 20 | Ok(()) |
|
19 | 21 | } |
General Comments 0
You need to be logged in to leave comments.
Login now