Trait salvo::prelude::Writer

source ·
pub trait Writer {
    // Required method
    fn write<'life0, 'life1, 'life2, 'async_trait>(
        self,
        req: &'life0 mut Request,
        depot: &'life1 mut Depot,
        res: &'life2 mut Response
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
}
Expand description

Writer is a trait allows you to implement custom writing logic for different data types.

Implementing the Writer trait for your data type allows you to use it writing the data to the Response object.

There are several built-in implementations of the Writer trait.

Required Methods§

source

fn write<'life0, 'life1, 'life2, 'async_trait>( self, req: &'life0 mut Request, depot: &'life1 mut Depot, res: &'life2 mut Response ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Write data to Response.

Implementations on Foreign Types§

source§

impl<P> Writer for Option<P>
where P: Scribe + Send,

source§

fn write<'life0, 'life1, 'life2, 'async_trait>( self, _req: &'life0 mut Request, _depot: &'life1 mut Depot, res: &'life2 mut Response ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Option<P>: 'async_trait,

source§

impl<T, E> Writer for Result<T, E>
where T: Writer + Send, E: Writer + Send,

source§

fn write<'life0, 'life1, 'life2, 'async_trait>( self, req: &'life0 mut Request, depot: &'life1 mut Depot, res: &'life2 mut Response ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Result<T, E>: 'async_trait,

Implementors§

source§

impl Writer for ParseError

source§

impl Writer for NamedFile

source§

impl<P> Writer for P
where P: Scribe + Send,

source§

impl<R> Writer for ReadSeeker<R>
where R: AsyncSeek + AsyncRead + Unpin + Send + 'static,