Skip to main content

ragged_buffer/
lib.rs

1#[cfg(feature = "python")]
2use pyo3::prelude::*;
3#[cfg(feature = "python")]
4use pyo3::wrap_pyfunction;
5#[cfg(feature = "python")]
6pub mod monomorphs;
7
8pub mod ragged_buffer;
9
10#[cfg(feature = "python")]
11pub mod ragged_buffer_view;
12
13#[cfg(feature = "python")]
14#[pymodule]
15#[pyo3(name = "ragged_buffer")]
16fn ragged_buffer_module(m: &Bound<'_, PyModule>) -> PyResult<()> {
17    // New exports also have to be added to __init__.py
18    m.add_class::<monomorphs::RaggedBufferF32>()?;
19    m.add_class::<monomorphs::RaggedBufferI64>()?;
20    m.add_class::<monomorphs::RaggedBufferBool>()?;
21    m.add_function(wrap_pyfunction!(translate_rotate, m)?)?;
22    Ok(())
23}
24
25#[cfg(feature = "python")]
26#[pyfunction]
27fn translate_rotate(
28    source: PyRef<'_, monomorphs::RaggedBufferF32>,
29    translation: PyRef<'_, monomorphs::RaggedBufferF32>,
30    rotation: PyRef<'_, monomorphs::RaggedBufferF32>,
31) -> PyResult<()> {
32    ragged_buffer_view::translate_rotate(&source.0, &translation.0, &rotation.0)
33}