Trait longport_httpcli::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

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromPayload for ()

§

type Err = Infallible

source§

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

source§

impl FromPayload for String

§

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,

§

type Err = Error