This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pt/members/pt-py/src/lib.rs

19 lines
481 B
Rust
Raw Normal View History

use pyo3::prelude::*;
2023-09-29 13:42:37 +02:00
// FIXME: simply importing libpt causes maturin to fail,
// -> `liblibpt.so` not found
// It works without the import
use libpt;
2023-09-29 13:42:37 +02:00
/// Formats the sum of two numbers as string.
#[pyfunction]
2023-09-29 13:42:37 +02:00
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
Ok((a + b).to_string())
}
2023-09-29 13:42:37 +02:00
/// A Python module implemented in Rust.
#[pymodule]
2023-09-29 13:42:37 +02:00
fn _libpt(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
2023-09-20 14:32:25 +02:00
Ok(())
}