bdk_chain::bitcoin::consensus::serde

Trait ByteDecoder

pub trait ByteDecoder<'a> {
    type InitError: IntoDeError + Debug;
    type DecodeError: IntoDeError + Debug;
    type Decoder: Iterator<Item = Result<u8, Self::DecodeError>>;

    // Required method
    fn from_str(s: &'a str) -> Result<Self::Decoder, Self::InitError>;
}
Expand description

Provides an instance of string-to-byte decoder.

This is basically a type constructor used in places where value arguments are not accepted. Such as the generic serialize.

Required Associated Types§

type InitError: IntoDeError + Debug

Error returned when decoder can’t be created.

This is typically returned when string length is invalid.

type DecodeError: IntoDeError + Debug

Error returned when decoding fails.

This is typically returned when the input string contains malformed chars.

type Decoder: Iterator<Item = Result<u8, Self::DecodeError>>

The decoder state.

Required Methods§

fn from_str(s: &'a str) -> Result<Self::Decoder, Self::InitError>

Constructs the decoder from string.

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.

Implementors§

§

impl<'a, C> ByteDecoder<'a> for Hex<C>
where C: Case,