pub enum Error {
TooShortBuffer {
actual: usize,
expected: usize,
file: &'static str,
line: u32,
},
FileIdentifierError(String),
FileVersioningError(String),
BlockIDError {
actual: String,
expected: String,
},
IOError(Error),
InvalidVersionString(String),
BlockLinkError(String),
BlockSerializationError(String),
ConversionChainTooDeep {
max_depth: usize,
},
ConversionChainCycle {
address: u64,
},
LinkCycle {
address: u64,
},
}Expand description
Errors that can occur during MDF file operations.
This enum covers all failure modes including I/O errors, parsing failures, and structural issues in the MDF file.
Variants§
TooShortBuffer
Buffer provided for parsing was too small.
This typically indicates file corruption or an incomplete read.
Fields
FileIdentifierError(String)
The file identifier is not “MDF “ as required by the specification.
This can occur when trying to open a non-MDF file or a file using an unsupported variant like “UnFinMF” (unfinalized MDF).
FileVersioningError(String)
The MDF version is not supported (requires 4.1 or later).
BlockIDError
A block identifier did not match the expected value.
Each MDF block starts with a 4-character identifier (e.g., “##HD” for the header block). This error indicates structural corruption.
Fields
IOError(Error)
An I/O error occurred while reading or writing the file.
Only available with the std feature.
InvalidVersionString(String)
The version string in the identification block could not be parsed.
BlockLinkError(String)
Failed to link blocks together during file writing.
This typically indicates a programming error where blocks are referenced before being written.
BlockSerializationError(String)
Failed to serialize a block to bytes.
ConversionChainTooDeep
A conversion chain exceeded the maximum allowed depth.
MDF supports chained conversions where one conversion references another. This error prevents infinite loops from malformed files.
ConversionChainCycle
A cycle was detected in a conversion chain.
This indicates file corruption where conversion blocks form a loop.
LinkCycle
A cycle was detected while walking a linked list of blocks (e.g. the data-group, channel-group, channel, or data-list chain).
This indicates file corruption where block links form a loop, which would otherwise cause the parser to loop forever.
Trait Implementations§
Source§impl Error for Error
Available on crate feature std only.
impl Error for Error
std only.Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()