pub enum Error {
TooLarge,
NormalFormRequired(NormalForm),
WrongColor(ColorType),
}
Expand description
Denotes invalid flat sample buffers when trying to convert to stricter types.
The biggest use case being ImageBuffer
which expects closely packed
samples in a row major matrix representation. But this error type may be
resused for other import functions. A more versatile user may also try to
correct the underlying representation depending on the error variant.
Variants
TooLarge
The represented image was too large.
The optional value denotes a possibly accepted maximal bound.
NormalFormRequired(NormalForm)
The represented image can not use this representation.
Has an additional value of the normalized form that would be accepted.
WrongColor(ColorType)
The color format did not match the channel count.
In some cases you might be able to fix this by lowering the reported pixel count of the buffer without touching the strides.
In very special circumstances you may do the opposite. This is VERY dangerous but not
directly memory unsafe although that will likely alias pixels. One scenario is when you
want to construct an Rgba
image but have only 3 bytes per pixel and for some reason don’t
care about the value of the alpha channel even though you need Rgba
.
Trait Implementations
sourceimpl Error for Error
impl Error for Error
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<Error> for ImageError
impl From<Error> for ImageError
sourcefn from(error: Error) -> ImageError
fn from(error: Error) -> ImageError
Performs the conversion.
impl Copy for Error
impl Eq for Error
impl StructuralEq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more