aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/lib.rs
blob: 166cb0975e5e760ab607a9450d22f0c1d63cd617 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use pyo3::prelude::*;

#[pyfunction]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
    Ok((a + b).to_string())
}

#[pyclass]
pub struct Base {}

#[pymodule]
fn _core(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
    m.add_class::<Base>()?;
    Ok(())
}