Trait Decodes

pub trait Decodes<T> {
    type Error: Display;

    // Required method
    fn decode(bytes: Bytes) -> Result<T, Self::Error>;
}
Expand description

A trait for types that can be decoded from a bytes for a response body.

Required Associated Types§

type Error: Display

The error type that can be returned if the decoding fails.

Required Methods§

fn decode(bytes: Bytes) -> Result<T, Self::Error>

Decodes the given bytes into a value.

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<CustErr> Decodes<ServerFnError<CustErr>> for ServerFnErrorEncoding
where CustErr: FromStr,

§

impl<T> Decodes<T> for JsonEncoding