Skip to main content

rustpix_io/
error.rs

1//! I/O error types.
2
3use thiserror::Error;
4
5/// Result type for I/O operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// I/O error types.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// File I/O error.
12    #[error("I/O error: {0}")]
13    Io(#[from] std::io::Error),
14
15    /// Memory mapping error.
16    #[error("memory mapping error: {0}")]
17    MmapError(String),
18
19    /// Invalid file format.
20    #[error("invalid file format: {0}")]
21    InvalidFormat(String),
22
23    /// Core library error.
24    #[error("core error: {0}")]
25    CoreError(#[from] rustpix_core::Error),
26
27    /// HDF5 error.
28    #[cfg(feature = "hdf5")]
29    #[error("hdf5 error: {0}")]
30    Hdf5(#[from] hdf5::Error),
31}