Debian Codegraph @

examples/hello-world-setuppy/rust/lib.rs

raw
1 use pyo3::prelude::*;
2
3 /// A Python module implemented in Rust. The name of this function must match
4 /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to
5 /// import the module.
6 #[pymodule]
7 mod _lib {
8 use pyo3::prelude::*;
9
10 /// Formats the sum of two numbers as string.
11 #[pyfunction]
12 fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
13 Ok((a + b).to_string())
14 }
15 }