#[non_exhaustive]pub enum Bech32Error {
InvalidHrp,
ConversionFailed,
OperationFailed,
UnexpectedHrp,
#[non_exhaustive] InvalidLength {
expected: usize,
got: usize,
},
}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 or encoding-bech32m.
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.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
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 (malformed string or checksum mismatch).
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
Source§fn clone(&self) -> Bech32Error
fn clone(&self) -> Bech32Error
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Bech32Error
Source§impl Debug for Bech32Error
impl Debug for Bech32Error
Source§impl Display for Bech32Error
Available on crate features encoding-bech32 or encoding-bech32m only.
impl Display for Bech32Error
encoding-bech32 or encoding-bech32m only.impl Eq for Bech32Error
Source§impl Error for Bech32Error
Available on crate feature std and (crate features encoding-bech32 or encoding-bech32m) only.
impl Error for Bech32Error
std and (crate features encoding-bech32 or encoding-bech32m) only.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 Bech32Error
impl PartialEq for Bech32Error
Source§fn eq(&self, other: &Bech32Error) -> bool
fn eq(&self, other: &Bech32Error) -> bool
self and other values to be equal, and is used by ==.