mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 21:34:51 -04:00
Add a stub Rust crate (#12595)
This commit is contained in:
parent
3d20115115
commit
c9b7e97355
23 changed files with 302 additions and 11 deletions
15
rust/src/lib.rs
Normal file
15
rust/src/lib.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
use pyo3::prelude::*;
|
||||
|
||||
/// Formats the sum of two numbers as string.
|
||||
#[pyfunction]
|
||||
#[pyo3(text_signature = "(a, b, /)")]
|
||||
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
|
||||
Ok((a + b).to_string())
|
||||
}
|
||||
|
||||
/// The entry point for defining the Python module.
|
||||
#[pymodule]
|
||||
fn synapse_rust(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
||||
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
|
||||
Ok(())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue