#[non_exhaustive]pub enum Sha256DigestError {
#[non_exhaustive] WrongLength {
got: u32,
},
#[non_exhaustive] NonHexLowercase {
at: u32,
byte: u8,
},
}Expand description
Parse error produced by Sha256::from_hex and the Sha256
Deserialize impl.
The enum is #[non_exhaustive] at the type level and every
variant is #[non_exhaustive] so future field additions and
variant additions both remain semver-additive (bd:JMAP-sf5h.21
ratified the single-tier shape — no wrapper struct is needed
because no extra context lives on the wrapper).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]WrongLength
The candidate had a length other than 64 UTF-8 bytes.
got is the actual byte length. The spec ABNF
(64( %x30-39 / %x61-66 )) is fixed-length and admits no
other length.
got is u32 (saturating, capped at u32::MAX) rather
than usize to avoid leaking a platform-dependent
integer width into the public error contract — the value
is realistically bounded by the input string length and any
candidate over 4 GiB would have been rejected earlier in the
parsing pipeline.
Per-variant #[non_exhaustive] so future field additions
remain semver-additive.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]NonHexLowercase
The candidate contained a byte outside the lowercase-hex set
[0-9 a-f] at the given 0-based position.
Uppercase hex is intentionally rejected — the spec ABNF
%x61-66 is the lowercase subset only.
at is u32 (saturating, capped at u32::MAX) rather
than usize; byte is the offending UTF-8 byte itself so
the diagnostic can report 0x41 ('A') for an uppercase
candidate without the caller having to re-index the input.
Per-variant #[non_exhaustive] so future field additions
remain semver-additive.
Fields
This variant is marked as non-exhaustive
Trait Implementations§
Source§impl Clone for Sha256DigestError
impl Clone for Sha256DigestError
Source§fn clone(&self) -> Sha256DigestError
fn clone(&self) -> Sha256DigestError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Sha256DigestError
impl Debug for Sha256DigestError
Source§impl Display for Sha256DigestError
impl Display for Sha256DigestError
impl Eq for Sha256DigestError
Source§impl Error for Sha256DigestError
impl Error for Sha256DigestError
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()
Source§impl PartialEq for Sha256DigestError
impl PartialEq for Sha256DigestError
Source§fn eq(&self, other: &Sha256DigestError) -> bool
fn eq(&self, other: &Sha256DigestError) -> bool
self and other values to be equal, and is used by ==.