Skip to main content

pigs/
lib.rs

1use pyo3::prelude::*;
2
3/// Formats the sum of two numbers as string.
4#[pyfunction]
5fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
6    Ok((a + b).to_string())
7}
8
9/// A Python module implemented in Rust.
10#[pymodule]
11fn pigs(_py: Python, m: &PyModule) -> PyResult<()> {
12    m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
13    Ok(())
14}