#[non_exhaustive]pub enum Bech32Error {
InvalidHrp,
OperationFailed,
UnexpectedHrp,
#[non_exhaustive] InvalidLength {
expected: usize,
got: usize,
},
}encoding-bech32 only.Expand description
Errors from Bech32 (BIP-173) and Bech32m (BIP-350) decoding. Variant shapes are identical in debug and release builds; no secret material (payload bytes, HRP strings) is ever carried in an error. Errors produced when decoding Bech32 (BIP-173) or Bech32m (BIP-350) strings.
Requires feature encoding-bech32.
Variant shapes are identical in debug and release builds. No input-derived strings (such as the received HRP) are ever captured — the caller already holds the input and the expected HRP.
Implements core::error::Error unconditionally — no std feature is
required, and the impl is present in no_std builds. (On the 0.8 line
this impl is std-gated, because core::error::Error needs Rust 1.81 and
that branch targets 1.70. Code that must build against both should not
assume the trait is available without std.)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidHrp
The Human-Readable Part (HRP) is invalid.
OperationFailed
General bech32 operation failure (malformed string or checksum mismatch).
This is where bit-conversion failures surface too: all bit conversion
happens inside CheckedHrpstring::new(), and the .byte_iter() that
follows a successful new() is infallible.
UnexpectedHrp
The decoded HRP does not match the HRP the caller required.
The received HRP is deliberately not captured — it is input-derived text. The caller passed the expected HRP and holds the input string.
#[non_exhaustive]InvalidLength
The decoded payload length does not match the target type’s length.
Fields
This variant is marked as non-exhaustive
Trait Implementations§
Source§impl Clone for Bech32Error
impl Clone for Bech32Error
impl Copy for Bech32Error
Source§impl Debug for Bech32Error
impl Debug for Bech32Error
Source§impl Display for Bech32Error
impl Display for Bech32Error
impl Eq 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()