#[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
ZeroDimension
An image or resize target with a width or height of 0.
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.
BufferLength
A pixel buffer whose length doesn’t match its width and height.
Fields
NotAnImageAlgorithm(Algorithm)
Image hashing asked of an algorithm that hashes text.
AlgorithmMismatch
Two hashes compared across algorithms or versions.
Fields
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
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.
ChunkCount
A chunk count outside 1..=bits, or one that leaves a chunk wider than 64 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: SignatureAlgorithmThe algorithm of the signature compared from.
right: SignatureAlgorithmThe algorithm of the signature compared to.
SignatureLength
Hex, bytes or values of the wrong length for the signature algorithm.
Fields
algorithm: SignatureAlgorithmThe algorithm the signature was read for.
BandCount
A band count that doesn’t divide the signature’s values into equal bands.
Decode(String)
An encoded image that couldn’t be decoded, or that is over the decoder limits.
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()