Skip to main content

Error

Enum Error 

Source
pub enum Error {
    General(String),
    BufferAllocationFailed {
        requested_bytes: usize,
        available_bytes: usize,
    },
    InvalidBufferHandle(usize),
    ShaderCompilationError {
        shader: String,
        message: String,
    },
    DispatchLimitExceeded {
        dispatch_size: usize,
        limit: usize,
    },
    GridIndexOutOfBounds {
        i: usize,
        j: usize,
        k: usize,
        nx: usize,
        ny: usize,
        nz: usize,
    },
    KernelArgCountMismatch {
        kernel: String,
        expected: usize,
        got: usize,
    },
    UnsupportedFeature {
        feature: String,
    },
}
Expand description

Main error type for the gpu module.

Variants§

§

General(String)

Generic error with a free-form message.

§

BufferAllocationFailed

A GPU buffer allocation failed.

Fields

§requested_bytes: usize

Bytes requested.

§available_bytes: usize

Bytes actually available.

§

InvalidBufferHandle(usize)

An invalid buffer handle was used.

§

ShaderCompilationError

A shader compilation error (mock).

Fields

§shader: String

Name of the offending shader.

§message: String

Compiler message.

§

DispatchLimitExceeded

A dispatch exceeded the hardware work-group limit.

Fields

§dispatch_size: usize

Requested dispatch size (number of work-groups).

§limit: usize

Hardware maximum.

§

GridIndexOutOfBounds

Out-of-bounds grid access.

Fields

§i: usize

Requested x index.

§j: usize

Requested y index.

§k: usize

Requested z index.

§nx: usize

Grid x dimension.

§ny: usize

Grid y dimension.

§nz: usize

Grid z dimension.

§

KernelArgCountMismatch

A kernel argument count mismatch.

Fields

§kernel: String

Kernel name.

§expected: usize

Expected number of arguments.

§got: usize

Provided number of arguments.

§

UnsupportedFeature

An unsupported backend feature was requested.

Fields

§feature: String

Description of the unsupported feature.

Implementations§

Source§

impl Error

Source

pub fn general(msg: impl Display) -> Self

Construct a Error::General from any Display-able value.

Source

pub fn is_allocation_error(&self) -> bool

True when this is a recoverable allocation error.

Source

pub fn is_shader_error(&self) -> bool

True when this is a shader compilation error.

Source

pub fn is_grid_error(&self) -> bool

True when this is an out-of-bounds grid error.

Source

pub fn is_arg_mismatch(&self) -> bool

True when this is a kernel argument mismatch error.

Source

pub fn is_unsupported(&self) -> bool

True when this is an unsupported feature error.

Source

pub fn in_stage(self, stage: impl Into<String>) -> PipelineStageError

Wrap this error in a PipelineStageError.

Source

pub fn fatal(self, kernel: Option<&str>) -> AnnotatedError

Annotate with fatal severity.

Source

pub fn warning(self, kernel: Option<&str>) -> AnnotatedError

Annotate with warning severity.

Source

pub fn into_err<T>(self) -> Result<T>

Convert into a Result::Err.

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

1.30.0 · 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 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§

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

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.