ToPayload

Trait ToPayload 

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

    // Required method
    fn to_bytes(&self) -> Result<Vec<u8>, Self::Err>;
}
Expand description

Represents a type that can convert to payload

Required Associated Types§

Source

type Err: Error

A error type

Required Methods§

Source

fn to_bytes(&self) -> Result<Vec<u8>, Self::Err>

Convert this object to the payload

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 ToPayload for ()

Source§

type Err = Infallible

Source§

fn to_bytes(&self) -> Result<Vec<u8>, Self::Err>

Source§

impl ToPayload for String

Implementors§

Source§

impl<T> ToPayload for Json<T>
where T: Serialize + Send + Sync + 'static,