Get basic incomplete Python queue API working

This commit is contained in:
Michael Bradley 2025-01-08 22:52:25 +13:00
parent 661e1d220a
commit 0995e6db90
Signed by: MichaelBradley
SSH key fingerprint: SHA256:cj/YZ5VT+QOKncqSkx+ibKTIn0Obg7OIzwzl9BL8EO8
8 changed files with 69 additions and 45 deletions

View file

@ -1,16 +1,12 @@
pub mod backing;
pub mod queue;
use pyo3::prelude::*;
use queue::pure::PureQueue;
/// Formats the sum of two numbers as string.
#[pyfunction]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
Ok((a + b).to_string())
}
/// A Python module implemented in Rust.
/// Bindings for the Rust queue implementations
#[pymodule]
fn pyority_queue(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
m.add_class::<PureQueue>()?;
Ok(())
}