Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 18 variants ZeroDimension { width: u32, height: u32, }, DimensionTooLarge { width: u32, height: u32, }, BufferLength { expected: usize, actual: usize, }, NotAnImageAlgorithm(Algorithm), AlgorithmMismatch { left: Algorithm, right: Algorithm, }, UnknownAlgorithm(String), MissingSeparator, WrongLength { algorithm: Algorithm, expected: usize, actual: usize, }, InvalidHex, NoIntegerForm { algorithm: Algorithm, }, ChunkCount { count: u32, bits: u32, }, ShingleSize, NotABitHash(SignatureAlgorithm), NotASignature(Algorithm), SignatureMismatch { left: SignatureAlgorithm, right: SignatureAlgorithm, }, SignatureLength { algorithm: SignatureAlgorithm, expected: usize, actual: usize, }, BandCount { bands: u32, values: u32, }, Decode(String),
}
Expand description

What went wrong. Every failure in this crate, bad input included, is one of these; nothing panics.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ZeroDimension

An image or resize target with a width or height of 0.

Fields

§width: u32

The width given.

§height: u32

The height given.

§

DimensionTooLarge

An image or resize target wider or taller than MAX_DIMENSION, or on a 32-bit target, one with more pixels than a buffer can hold.

Fields

§width: u32

The width given.

§height: u32

The height given.

§

BufferLength

A pixel buffer whose length doesn’t match its width and height.

Fields

§expected: usize

The length the width, height and channel count call for.

§actual: usize

The length given.

§

NotAnImageAlgorithm(Algorithm)

Image hashing asked of an algorithm that hashes text.

§

AlgorithmMismatch

Two hashes compared across algorithms or versions.

Fields

§left: Algorithm

The algorithm of the hash compared from.

§right: Algorithm

The algorithm of the hash compared to.

§

UnknownAlgorithm(String)

An algorithm id that this version of the crate doesn’t know.

§

MissingSeparator

A hash string without the : between the algorithm id and the hex.

§

WrongLength

Hex or bytes of the wrong length for the algorithm.

Fields

§algorithm: Algorithm

The algorithm the value was read for.

§expected: usize

The length the algorithm needs, in hex digits or bytes as the input is.

§actual: usize

The length given.

§

InvalidHex

A hex string with a character that isn’t a hex digit.

§

NoIntegerForm

An integer form asked of an algorithm whose hashes aren’t 64 bits wide.

Fields

§algorithm: Algorithm

The algorithm of the hash.

§

ChunkCount

A chunk count outside 1..=bits, or one that leaves a chunk wider than 64 bits.

Fields

§count: u32

The count asked for.

§bits: u32

The width of the hash in bits.

§

ShingleSize

A shingle size of 0.

§

NotABitHash(SignatureAlgorithm)

The id of a signature algorithm, such as minhash-v1, read as a bit-hash algorithm.

§

NotASignature(Algorithm)

The id of a bit-hash algorithm, such as simhash-v1, read as a signature algorithm.

§

SignatureMismatch

Two signatures compared or combined across algorithms or versions.

Fields

§left: SignatureAlgorithm

The algorithm of the signature compared from.

§right: SignatureAlgorithm

The algorithm of the signature compared to.

§

SignatureLength

Hex, bytes or values of the wrong length for the signature algorithm.

Fields

§algorithm: SignatureAlgorithm

The algorithm the signature was read for.

§expected: usize

The length the algorithm needs, in hex digits, bytes or values as the input is.

§actual: usize

The length given.

§

BandCount

A band count that doesn’t divide the signature’s values into equal bands.

Fields

§bands: u32

The count asked for.

§values: u32

The number of values in the signature.

§

Decode(String)

An encoded image that couldn’t be decoded, or that is over the decoder limits.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

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

Replaced by Error::source.
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
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error
where RawVecInner: Send,

§

impl Sync for Error
where RawVecInner: Sync,

§

impl Unpin for Error
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error
where RawVecInner: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.