#[non_exhaustive]pub enum CoreError {
InvalidConfig(String),
ShapeMismatch {
expected: Vec<usize>,
actual: Vec<usize>,
},
DimensionMismatch {
message: String,
},
DeviceNotAvailable {
device: String,
},
DeviceMismatch,
OutOfMemory {
message: String,
},
KernelError {
message: String,
},
NotImplemented {
feature: String,
},
Io(String),
Candle(Error),
}Expand description
Core errors shared across the rust-ai ecosystem.
These errors represent common failure modes that can occur in any crate. Domain-specific errors should wrap these variants.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidConfig(String)
Invalid configuration parameter.
Raised when a configuration value is out of bounds, incompatible, or otherwise invalid.
ShapeMismatch
Tensor shape mismatch.
Raised when an operation expects tensors of specific shapes but receives tensors with incompatible shapes.
DimensionMismatch
Dimension count mismatch.
Raised when tensors have different numbers of dimensions.
DeviceNotAvailable
Requested device not available.
Raised when attempting to use a device (e.g., CUDA:1) that doesn’t exist or isn’t accessible.
DeviceMismatch
Device mismatch between tensors.
Raised when an operation requires tensors on the same device but they reside on different devices.
OutOfMemory
Out of memory.
Raised when GPU or CPU memory allocation fails.
KernelError
GPU kernel error.
Raised when a CUDA/CubeCL kernel fails to launch or execute.
NotImplemented
Feature not implemented.
Raised when a requested feature or code path is not yet implemented.
Io(String)
I/O error.
Raised for file operations, network errors, serialization failures, etc.
Candle(Error)
Underlying Candle error.
Wraps errors from the Candle tensor library.
Implementations§
Source§impl CoreError
impl CoreError
Sourcepub fn invalid_config(msg: impl Into<String>) -> Self
pub fn invalid_config(msg: impl Into<String>) -> Self
Create an invalid configuration error.
Sourcepub fn shape_mismatch(
expected: impl Into<Vec<usize>>,
actual: impl Into<Vec<usize>>,
) -> Self
pub fn shape_mismatch( expected: impl Into<Vec<usize>>, actual: impl Into<Vec<usize>>, ) -> Self
Create a shape mismatch error.
Sourcepub fn dim_mismatch(msg: impl Into<String>) -> Self
pub fn dim_mismatch(msg: impl Into<String>) -> Self
Create a dimension mismatch error.
Sourcepub fn device_not_available(device: impl Into<String>) -> Self
pub fn device_not_available(device: impl Into<String>) -> Self
Create a device not available error.
Sourcepub fn not_implemented(feature: impl Into<String>) -> Self
pub fn not_implemented(feature: impl Into<String>) -> Self
Create a not implemented error.
Trait Implementations§
Source§impl Error for CoreError
impl Error for CoreError
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
Auto Trait Implementations§
impl Freeze for CoreError
impl !RefUnwindSafe for CoreError
impl Send for CoreError
impl Sync for CoreError
impl Unpin for CoreError
impl !UnwindSafe for CoreError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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