Skip to main content

Encoder

Trait Encoder 

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

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

Encodes a borrowed input value into another representation.

Required Associated Types§

Source

type Output

Encoded output type.

Source

type Error

Encoding error type.

Required Methods§

Source

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

Encodes input.

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

Encoded output.

§Errors

Returns an error when the codec cannot represent the supplied input.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§