Trait RequestContents

Source
pub trait RequestContents {
    type Content: Send + Sized + 'static;

    // Required method
    fn from_body<'async_trait>(
        body: Body,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Content, Status>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

The deserializer trait for converting the request body into the desired type specified by Self::Content.

This trait is automatically implemented for the Body type and any type implementing rkyv’s (de)serializer traits.

Required Associated Types§

Source

type Content: Send + Sized + 'static

The deserialized message type.

Required Methods§

Source

fn from_body<'async_trait>( body: Body, ) -> Pin<Box<dyn Future<Output = Result<Self::Content, Status>> + Send + 'async_trait>>
where Self: 'async_trait,

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§

Source§

impl RequestContents for Body

Source§

impl<Msg> RequestContents for Msg
where Msg: Archive + Send + Sync + 'static, Msg::Archived: CheckBytes<DefaultValidator<'static>> + Send + Sync + 'static,