Rust API Reference#
This section documents the internal Rust implementation of
read_aconity_layers.
Note
This documentation is primarily intended for contributors and developers who want to understand the internal implementation. Most users should refer to the Python API Reference instead.
Rust API:
Overview#
The Rust implementation provides the high-performance core of
read_aconity_layers. Key characteristics include:
Performance Features#
Parallel Processing: Uses Rayon for parallel file reading across all CPU cores
Memory Efficiency: Streams data rather than loading everything into memory at once
SIMD Operations: Leverages vectorized operations for coordinate corrections
Zero-Copy: Minimizes data copying between Rust and Python using PyO3
Architecture#
The crate is organized into two main components:
Public API (
src/lib.rs): PyO3 bindings that expose Rust functions to PythonCore Logic (
src/rust_fn/): Pure Rust implementation of file reading and processing
Error Handling#
The Rust code uses a comprehensive ReadError enum that covers all
possible failure modes, from I/O errors to parsing failures. These are
automatically converted to appropriate Python exceptions through the
PyO3 integration.
Dependencies#
Key Rust dependencies that power the performance:
ndarray- N-dimensional arrays with BLAS integrationrayon- Data parallelism librarycsv- Fast CSV parsingpyo3- Python bindingsnumpy- NumPy integration for PyO3glob- File path pattern matchingindicatif- Progress bars for long operations