Skip to main content

MatError

Enum MatError 

Source
#[non_exhaustive]
pub enum MatError {
Show 13 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), 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§expected: usize

Expected row length (first row).

§got: usize

The row that differed.

§

ShapeMismatch

A dataset’s on-disk shape didn’t match the Rust type.

Fields

§expected: String

The Rust side’s expectation.

§actual: String

What the file contained.

§

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.

§

Custom(String)

A generic serde-originated error (from Error::custom).

Trait Implementations§

Source§

impl Debug for MatError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for MatError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for MatError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for MatError

Source§

fn from(e: Hdf5Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for MatError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FormatError> for MatError

Source§

fn from(e: FormatError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.