pub trait Format: Sized {
type EncodedBytes<'a>: AsRef<[u8]>
where Self: 'a;
const HRP: Hrp;
// Required methods
fn to_bytes(&self) -> Self::EncodedBytes<'_>;
fn decode_bytes(bytes: &[u8]) -> Result<Self, DecodeError>;
// Provided methods
fn encode(&self) -> String { ... }
fn decode(string: impl AsRef<str>) -> Result<Self, DecodeError> { ... }
}Expand description
Format to string with bech32m
Required Associated Constants§
Required Associated Types§
Sourcetype EncodedBytes<'a>: AsRef<[u8]>
where
Self: 'a
type EncodedBytes<'a>: AsRef<[u8]> where Self: 'a
Encoded bytes representation of Self.
Required Methods§
Sourcefn to_bytes(&self) -> Self::EncodedBytes<'_>
fn to_bytes(&self) -> Self::EncodedBytes<'_>
Encode Self to bytes
Sourcefn decode_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
fn decode_bytes(bytes: &[u8]) -> Result<Self, DecodeError>
Try to decode Self from bytes
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.