pub enum StorageError {
ScalarKindMismatch {
expected: &'static str,
actual: &'static str,
operation: &'static str,
},
LengthMismatch {
operation: &'static str,
left: usize,
right: usize,
},
InvalidStructuredStorage(String),
OperationNotSupported {
operation: &'static str,
left: &'static str,
right: &'static str,
},
RealScalarRequired {
operation: &'static str,
a: String,
b: String,
},
}Expand description
Errors returned by storage payload and elementwise operations.
Use this to distinguish scalar-kind mismatches, length mismatches, and invalid structured-storage metadata from general backend failures.
§Examples
use tensor4all_tensorbackend::{Storage, StorageError};
let storage = Storage::from_dense_col_major(vec![1.0_f64], &[1]).unwrap();
let err = storage.payload_c64_col_major_vec().unwrap_err();
assert!(matches!(err, StorageError::ScalarKindMismatch { .. }));Variants§
ScalarKindMismatch
The storage scalar kind did not match the requested operation.
Fields
LengthMismatch
Two storages had different payload lengths for an elementwise operation.
Fields
InvalidStructuredStorage(String)
Structured storage metadata was invalid after an operation.
OperationNotSupported
The requested operation does not support the provided storage kinds.
Fields
RealScalarRequired
The requested operation requires real scalars but at least one scalar was complex.
Trait Implementations§
Source§impl Debug for StorageError
impl Debug for StorageError
Source§impl Display for StorageError
impl Display for StorageError
Source§impl Error for StorageError
impl Error for StorageError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for StorageError
impl RefUnwindSafe for StorageError
impl Send for StorageError
impl Sync for StorageError
impl Unpin for StorageError
impl UnsafeUnpin for StorageError
impl UnwindSafe for StorageError
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
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<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>
Converts
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>
Converts
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