Skip to main content

PayloadTrait

Trait PayloadTrait 

Source
pub trait PayloadTrait: Sized {
    type JsonType: Serialize + DeserializeOwned + Debug;

    // Required methods
    fn to_payload(&self) -> Payload<&Self::JsonType>;
    fn into_payload(self) -> Payload<Self::JsonType>;
    fn from_payload(payload: Payload<Self::JsonType>) -> Result<Self>;
}
Expand description

What’s expected from a EndpointDetails::RequestType.

Required Associated Types§

Required Methods§

Source

fn to_payload(&self) -> Payload<&Self::JsonType>

Used when creating requests

Source

fn into_payload(self) -> Payload<Self::JsonType>

Used when forming responses

Source

fn from_payload(payload: Payload<Self::JsonType>) -> Result<Self>

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§