pub enum Bech32Error {
InvalidHrp,
ConversionFailed,
OperationFailed,
UnexpectedHrp {
expected: String,
got: String,
},
InvalidLength {
expected: usize,
got: usize,
},
}Expand description
Errors from Bech32 (BIP-173) and Bech32m (BIP-350) decoding. Debug builds include detailed context; release builds use generic messages. Errors produced when decoding Bech32 (BIP-173) or Bech32m (BIP-350) strings.
Requires feature encoding-bech32 or encoding-bech32m.
In debug builds UnexpectedHrp and InvalidLength carry expected/got
fields for development debugging. In release builds these variants are opaque
to prevent leaking expected-length or HRP metadata.
Variants§
InvalidHrp
The Human-Readable Part (HRP) is invalid.
ConversionFailed
Bit conversion during encoding/decoding failed.
Currently unreachable. After CheckedHrpstring::new() succeeds, the
.byte_iter() iterator is infallible — all bit-conversion happens during
the new() call and any failure surfaces as OperationFailed instead.
This variant is preserved as public API for forward compatibility should a
fallible conversion path be introduced in a future release of the bech32 crate.
OperationFailed
General bech32 operation failure.
UnexpectedHrp
Unexpected HRP in debug builds (detailed).
InvalidLength
Length mismatch in debug builds (detailed).
Trait Implementations§
Source§impl Clone for Bech32Error
impl Clone for Bech32Error
Source§fn clone(&self) -> Bech32Error
fn clone(&self) -> Bech32Error
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Bech32Error
impl Debug for Bech32Error
Source§impl Display for Bech32Error
impl Display for Bech32Error
Source§impl Error for Bech32Error
impl Error for Bech32Error
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()