pub enum MlError {
DeviceUnavailable(String),
FeatureDisabled(&'static str),
ModelLoad {
path: PathBuf,
reason: String,
},
InvalidInput(String),
Preprocess(String),
Postprocess(String),
Pipeline {
stage: &'static str,
message: String,
},
CacheCapacityZero,
OnnxRuntime(String),
}Expand description
Errors surfaced by oximedia-ml.
Construct user-facing failures with MlError::invalid_input,
MlError::preprocess, MlError::postprocess, or
MlError::pipeline; the remaining variants are usually produced by
the crate itself and matched on at call sites.
Variants§
The requested device is either unknown, unavailable, or built without its feature flag.
FeatureDisabled(&'static str)
A feature required to perform the operation is disabled.
ModelLoad
The model file could not be loaded from disk.
Fields
InvalidInput(String)
Input tensor(s) did not match the model’s contract.
Preprocess(String)
Pre-processing failed (e.g. image dimensions don’t fit).
Postprocess(String)
Post-processing failed (e.g. reading an output tensor).
Pipeline
A pipeline sub-component failed to execute.
Fields
CacheCapacityZero
The cache capacity was zero, which is invalid.
OnnxRuntime(String)
Underlying ONNX runtime error (feature-gated).
Implementations§
Source§impl MlError
impl MlError
Sourcepub fn pipeline(stage: &'static str, message: impl Into<String>) -> Self
pub fn pipeline(stage: &'static str, message: impl Into<String>) -> Self
Convenience constructor for pipeline errors.
Sourcepub fn invalid_input(message: impl Into<String>) -> Self
pub fn invalid_input(message: impl Into<String>) -> Self
Convenience constructor for invalid input errors.
Sourcepub fn preprocess(message: impl Into<String>) -> Self
pub fn preprocess(message: impl Into<String>) -> Self
Convenience constructor for preprocess errors.
Sourcepub fn postprocess(message: impl Into<String>) -> Self
pub fn postprocess(message: impl Into<String>) -> Self
Convenience constructor for postprocess errors.
Trait Implementations§
Source§impl Error for MlError
impl Error for MlError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for MlError
impl RefUnwindSafe for MlError
impl Send for MlError
impl Sync for MlError
impl Unpin for MlError
impl UnsafeUnpin for MlError
impl UnwindSafe for MlError
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 moreSource§impl<E> OxiErrorExt for Ewhere
E: Error,
impl<E> OxiErrorExt for Ewhere
E: Error,
Source§fn with_oxi_context(self, frame: ErrorFrame) -> OxiError
fn with_oxi_context(self, frame: ErrorFrame) -> OxiError
self by prepending the frame’s display string as context.