Skip to main content

Decoder

Trait Decoder 

Source
pub trait Decoder<Input: ?Sized> {
    type Output;
    type Error;

    // Required method
    fn decode(&self, input: &Input) -> Result<Self::Output, Self::Error>;
}
Expand description

Decodes a borrowed input value into an owned representation.

This trait is a convenience-layer API. Use crate::Codec for low-level single-value buffer decoding and crate::Transcoder for batch conversion over caller-provided buffers.

Required Associated Types§

Source

type Output

Decoded output type.

Source

type Error

Decoding error type.

Required Methods§

Source

fn decode(&self, input: &Input) -> Result<Self::Output, Self::Error>

Decodes input.

§Parameters
  • input: Source value to decode.
§Returns

Decoded output.

§Errors

Returns an error when the input is malformed or unsupported by the codec.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§