FromPayload

Trait FromPayload 

Source
pub trait FromPayload:
    Sized
    + Send
    + Sync
    + 'static {
    type Err: Error;

    // Required method
    fn parse_from_bytes(data: &[u8]) -> Result<Self, Self::Err>;
}
Expand description

Represents a type that can parse from payload

Required Associated Types§

Source

type Err: Error

A error type

Required Methods§

Source

fn parse_from_bytes(data: &[u8]) -> Result<Self, Self::Err>

Parse the payload to this object

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.

Implementations on Foreign Types§

Source§

impl FromPayload for ()

Source§

type Err = Infallible

Source§

fn parse_from_bytes(_data: &[u8]) -> Result<Self, Self::Err>

Source§

impl FromPayload for String

Source§

type Err = FromUtf8Error

Source§

fn parse_from_bytes(data: &[u8]) -> Result<Self, Self::Err>

Implementors§

Source§

impl<T> FromPayload for Json<T>
where T: DeserializeOwned + Send + Sync + 'static,