#[non_exhaustive]pub enum AddressError {
NotLowercase,
InvalidBech32m {
reason: String,
},
HrpMismatch {
found: String,
expected: &'static str,
},
PayloadLength {
len: usize,
expected: usize,
},
VersionMismatch {
found: u8,
expected: u8,
},
NonCanonical,
}Expand description
Why an address string was rejected by Address::from_str.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotLowercase
The string contains ASCII uppercase.
BIP-173 permits an all-uppercase spelling and the bech32 crate
accepts it; the protocol admits the lowercase form only.
InvalidBech32m
The string is not structurally valid bech32m: bad charset, missing or misplaced separator, mixed case, or a checksum that is absent, corrupt, or computed with the original bech32 constant instead of bech32m.
HrpMismatch
Valid bech32m, but the human-readable part is not Address::HRP_STR.
Fields
PayloadLength
The decoded payload is not Address::PAYLOAD_LEN bytes.
VersionMismatch
The payload does not start with a supported version byte.
Fields
NonCanonical
The string decodes to a well-formed payload but is not that payload’s canonical spelling — non-zero padding bits, or a data part padded out with extra characters that truncate to the same bytes.
Accepting these would give one identity several valid addresses, so they are rejected rather than normalized.
Trait Implementations§
Source§impl Clone for AddressError
impl Clone for AddressError
Source§impl Debug for AddressError
impl Debug for AddressError
Source§impl Display for AddressError
impl Display for AddressError
impl Eq for AddressError
Source§impl Error for AddressError
impl Error for AddressError
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()