From fc40b9e0c78a2682e8336c5f3acc8856a7b23680 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Wed, 28 May 2025 15:11:45 +0100 Subject: [PATCH] Added python docstrings to rust code --- src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 029ff85..e74c2a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,13 @@ impl From for PyErr { } } +/// Read all layers from the given directory. +/// +/// Args: +/// folder (str): The path to the directory to read from. +/// +/// Returns: +/// ndarray: The parsed and corrected layer data. #[pyfunction] fn read_layers<'py>(_py: Python<'py>, folder: &'py str) -> PyResult>> where @@ -41,6 +48,13 @@ where Ok(py_result) } +/// Read a list of layer files. +/// +/// Args: +/// file_list (List[str]): The list of filepaths to read from. +/// +/// Returns: +/// ndarray: The parsed and corrected layer data. #[pyfunction] fn read_selected_layers( _py: Python<'_>, @@ -55,6 +69,13 @@ fn read_selected_layers( Ok(py_result) } +/// Reads a layer from at the given filepath. +/// +/// Args: +/// file (str): The path to the file to read from. +/// +/// Returns: +/// ndarray: The parsed and corrected layer data. #[pyfunction] fn read_layer(_py: Python<'_>, file: String) -> PyResult>> { let rs_result = rust_fn::read_layer(&file)?; @@ -62,6 +83,8 @@ fn read_layer(_py: Python<'_>, file: String) -> PyResult Ok(py_result) } +/// A library for fast and efficient reading of layer data from the aconity mini powder bed fusion +/// machine. #[pymodule] fn read_aconity_layers(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(read_layers, m)?)?;