Enum Error
enum Error
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.
-
ChannelCountMismatch(u8, u8) 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
Rgbaimage but have only 3 bytes per pixel and for some reason don't care about the value of the alpha channel even though you needRgba.-
WrongColor(crate::color::ColorType) Deprecated -
ChannelCountMismatchis used instead
Implementations
impl Clone for Error
fn clone(self: &Self) -> Error
impl Copy for Error
impl Debug for Error
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Display for Error
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for Error
impl Error for Error
impl Freeze for Error
impl Hash for Error
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl PartialEq for Error
fn eq(self: &Self, other: &Error) -> bool
impl RefUnwindSafe for Error
impl Send for Error
impl StructuralPartialEq for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
impl<T> Any for Error
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Error
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Error
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Error
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Error
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for Error
unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> ToOwned for Error
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Error
fn to_string(self: &Self) -> String
impl<T, U> Into for Error
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Error
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Error
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>