You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
411 B

  1. use pyo3::prelude::*;
  2. /// Formats the sum of two numbers as string.
  3. #[pyfunction]
  4. #[pyo3(text_signature = "(a, b, /)")]
  5. fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
  6. Ok((a + b).to_string())
  7. }
  8. /// The entry point for defining the Python module.
  9. #[pymodule]
  10. fn synapse_rust(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
  11. m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
  12. Ok(())
  13. }