#[non_exhaustive]pub enum Error {
Op {
op: &'static str,
at: Option<&'static Location<'static>>,
kind: OpErrorKind,
},
OutOfMemory(usize),
Backend(String),
UnsupportedDevice(Device),
Io(String),
InvalidArgument(String),
}Expand description
Why an operation failed.
Array operations never return this directly: an invalid call yields a failed array
that carries an Error::Op (the op’s name, the caller’s source location and the
reason), and every array computed from it carries the same error. It surfaces as Err
at the boundary: crate::Array::check, crate::Array::eval,
crate::Array::item, crate::Array::to_vec, I/O and transforms. Errors that
happen while evaluating (a GPU failure, memory exhausted) use the other variants.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Op
An array operation rejected its arguments when it was recorded.
Fields
at: Option<&'static Location<'static>>Where the caller invoked it; None for an error built inside nuvec that no
public operation has located (see Error::location).
kind: OpErrorKindWhy it failed.
OutOfMemory(usize)
Memory for this many bytes could not be allocated (or exceeds the memory limit).
Backend(String)
The GPU backend failed (for example, a command buffer error).
UnsupportedDevice(Device)
No backend is available for the device (the GPU without Metal).
Io(String)
Reading or writing a file failed.
InvalidArgument(String)
An argument of a boundary function (transforms, loaders) is invalid.
Implementations§
Source§impl Error
impl Error
Sourcepub fn kind(&self) -> Option<&OpErrorKind>
pub fn kind(&self) -> Option<&OpErrorKind>
The reason of an op error.
Sourcepub fn location(&self) -> Option<&'static Location<'static>>
pub fn location(&self) -> Option<&'static Location<'static>>
Where the failing op was called, for op errors raised by a public operation.
Sourcepub fn is_oom(&self) -> bool
pub fn is_oom(&self) -> bool
Whether memory ran out: Error::OutOfMemory, or an op error of kind
OpErrorKind::OutOfMemory (an allocation that failed while an op was recorded).
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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