diff options
| author | 2024-02-28 11:37:54 +0800 | |
|---|---|---|
| committer | 2024-02-28 11:37:54 +0800 | |
| commit | 672e0d03d3ffdba740d166f2c4a7243f142cec5f (patch) | |
| tree | 46cdb4ea015877e7828710a47c945aa2e834beb0 /src/lib.rs | |
| parent | fc6fc64ca3ff7df62dd270fc021f674e56b2dedf (diff) | |
| download | TRPGNivis-672e0d03d3ffdba740d166f2c4a7243f142cec5f.tar.gz TRPGNivis-672e0d03d3ffdba740d166f2c4a7243f142cec5f.zip | |
refactor!: built in rust
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..a9e8d04 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,14 @@ +use pyo3::prelude::*; + +/// Formats the sum of two numbers as string. +#[pyfunction] +fn sum_as_string(a: usize, b: usize) -> PyResult<String> { + Ok((a + b).to_string()) +} + +/// A Python module implemented in Rust. +#[pymodule] +fn nivis_python(_py: Python, m: &PyModule) -> PyResult<()> { + m.add_function(wrap_pyfunction!(sum_as_string, m)?)?; + Ok(()) +} |
