#[non_exhaustive]pub enum MatError {
Show 15 variants
Hdf5(Error),
Format(FormatError),
Io(Error),
RootMustBeStruct,
UnsupportedType(&'static str),
MixedSequenceElementTypes,
RaggedMatrix {
expected: usize,
got: usize,
},
ShapeMismatch {
expected: String,
actual: String,
},
MissingField(String),
UnknownClass(String),
UnsupportedMatlabClass(String),
Utf16Decode(String),
BlockSizeMismatch {
block: usize,
expected: usize,
actual: usize,
},
CompressionUnsupportedForBlocks,
Custom(String),
}Expand description
Errors that can occur when (de)serializing .mat v7.3 files.
Marked #[non_exhaustive]: reading MATLAB’s MCOS opaque classes is an
ongoing effort (datetime, categorical, table, containers.Map,
dictionary, …), and each newly decoded — or newly refused — class can
introduce a more specific error variant. Keeping the enum open lets those
additions land without a breaking change, so downstream matches must
include a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Hdf5(Error)
Underlying HDF5 I/O or format error.
Format(FormatError)
Underlying HDF5 format parse error.
Io(Error)
I/O error when reading or writing a file path.
RootMustBeStruct
Top-level must be a struct with named fields (each field becomes a MATLAB variable).
UnsupportedType(&'static str)
The requested Rust type has no MATLAB v7.3 encoding in this crate.
MixedSequenceElementTypes
A sequence contained elements of different primitive types.
RaggedMatrix
A 2-D matrix had inconsistent row lengths.
ShapeMismatch
A dataset’s on-disk shape didn’t match the Rust type.
MissingField(String)
A required struct field was missing from the file.
UnknownClass(String)
A MATLAB_class attribute value wasn’t recognized.
UnsupportedMatlabClass(String)
A recognized but not-yet-supported MATLAB class was encountered on read
— an MCOS opaque class (datetime, categorical, table,
containers.Map, dictionary, an enumeration, a user classdef, …)
whose decoder is not yet implemented. Refused by name rather than
misread; the modern string class is supported.
Utf16Decode(String)
UTF-16 decoding of a char dataset failed.
BlockSizeMismatch
A DataProducer wrote the wrong number of
bytes for a block. Refused rather than written: a block of the wrong size
displaces every address after it, and the result would be a file that
fails to open for reasons that no longer point back here.
Fields
expected: usizeBytes it had to write, as
Blocking::block_len reports.
CompressionUnsupportedForBlocks
A producer-backed dataset was asked for on a builder configured for compression. The layout needs each block’s exact on-disk size before it writes anything, and a compressed block’s size is not knowable without compressing it — which would buffer the data the path exists to avoid.
Custom(String)
A generic serde-originated error (from Error::custom).
Trait Implementations§
Source§impl Error for MatError
impl Error for MatError
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()
Source§impl Error for MatError
Available on crate feature serde only.
impl Error for MatError
serde only.Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.Source§impl From<FormatError> for MatError
impl From<FormatError> for MatError
Source§fn from(e: FormatError) -> Self
fn from(e: FormatError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for MatError
impl !UnwindSafe for MatError
impl Freeze for MatError
impl Send for MatError
impl Sync for MatError
impl Unpin for MatError
impl UnsafeUnpin for MatError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more