Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 21 variants InvalidConfig(String), BackendNotCompiled { backend: &'static str, feature: &'static str, }, BackendUnavailable(&'static str), ModelRead { path: PathBuf, source: Error, }, Native { operation: &'static str, message: String, }, DuplicateTensor { kind: &'static str, name: String, }, MissingInput(String), UnknownTensor { kind: &'static str, name: String, }, ShapeMismatch { name: String, expected: Vec<i32>, actual: Vec<usize>, }, DataLengthMismatch { name: String, expected: usize, actual: usize, }, ShapeOverflow { name: String, }, UnresolvedShape { name: String, }, InvalidShape { name: String, shape: Vec<usize>, }, CacheDirectory { path: PathBuf, source: Error, }, QueueFull, Cancelled, DeadlineExceeded, ThreadCountLimited { requested: usize, effective: usize, }, WorkerStopped, WorkerPanicked, ExecutionGatePoisoned,
}
Expand description

MNN runtime error.

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.
§

InvalidConfig(String)

Runtime configuration is invalid.

§

BackendNotCompiled

The selected backend was not compiled into the binary.

Fields

§backend: &'static str

Stable backend name.

§feature: &'static str

Required Cargo feature.

§

BackendUnavailable(&'static str)

The feature is enabled but the linked MNN library lacks the backend.

§

ModelRead

A model file could not be read.

Fields

§path: PathBuf

Model path.

§source: Error

Underlying I/O failure.

§

Native

The native MNN layer rejected an operation.

Fields

§operation: &'static str

Operation being performed.

§message: String

Native error details.

§

DuplicateTensor

A tensor name was repeated.

Fields

§kind: &'static str

Whether this was an input or output.

§name: String

Tensor name.

§

MissingInput(String)

A required input was not provided.

§

UnknownTensor

The caller provided a tensor not present in the model.

Fields

§kind: &'static str

Whether this was an input or output.

§name: String

Tensor name.

§

ShapeMismatch

Tensor shape did not match model metadata.

Fields

§name: String

Tensor name.

§expected: Vec<i32>

Shape declared by the model.

§actual: Vec<usize>

Shape supplied by the caller.

§

DataLengthMismatch

Tensor element count does not match its shape.

Fields

§name: String

Tensor name.

§expected: usize

Required element count.

§actual: usize

Supplied element count.

§

ShapeOverflow

Shape element count overflowed or exceeded native allocation limits.

Fields

§name: String

Tensor name.

§

UnresolvedShape

A shape is not concrete yet.

Fields

§name: String

Tensor name.

§

InvalidShape

Concrete shapes must have positive dimensions and rank at most eight.

Fields

§name: String

Tensor name.

§shape: Vec<usize>

Supplied dimensions.

§

CacheDirectory

Cache directory creation failed.

Fields

§path: PathBuf

Cache directory.

§source: Error

Underlying I/O failure.

§

QueueFull

The bounded model queue is full. The request was not accepted.

§

Cancelled

A queued request was cancelled or its handle was dropped.

§

DeadlineExceeded

A request deadline or result wait expired.

§

ThreadCountLimited

The existing native pool cannot satisfy the requested thread count.

Fields

§requested: usize

Requested thread count.

§effective: usize

Actual count reported by the session.

§

WorkerStopped

A model worker stopped unexpectedly.

§

WorkerPanicked

A model worker panicked during startup.

§

ExecutionGatePoisoned

The process-wide execution gate was poisoned by a panic.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.