Skip to main content

Writer

Trait 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 used to write data to Response.

Writer requires the use of Depot and Request, which allows for greater flexibility. For scenarios that do not require this flexibility, Scribe can be used, for example Text, Json are implemented from Scribe.

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<A, B, C, D, E, F, G, H> Writer for (A, B, C, D, E, F, G, H)
where A: Writer + Send, B: Writer + Send, C: Writer + Send, D: Writer + Send, E: Writer + Send, F: Writer + Send, G: Writer + Send, H: 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, (A, B, C, D, E, F, G, H): 'async_trait,

Source§

impl<A, B, C, D, E, F, G> Writer for (A, B, C, D, E, F, G)
where A: Writer + Send, B: Writer + Send, C: Writer + Send, D: Writer + Send, E: Writer + Send, F: Writer + Send, G: 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, (A, B, C, D, E, F, G): 'async_trait,

Source§

impl<A, B, C, D, E, F> Writer for (A, B, C, D, E, F)
where A: Writer + Send, B: Writer + Send, C: Writer + Send, D: Writer + Send, E: Writer + Send, F: 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, (A, B, C, D, E, F): 'async_trait,

Source§

impl<A, B, C, D, E> Writer for (A, B, C, D, E)
where A: Writer + Send, B: Writer + Send, C: Writer + Send, D: 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, (A, B, C, D, E): 'async_trait,

Source§

impl<A, B, C, D> Writer for (A, B, C, D)
where A: Writer + Send, B: Writer + Send, C: Writer + Send, D: 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, (A, B, C, D): 'async_trait,

Source§

impl<A, B, C> Writer for (A, B, C)
where A: Writer + Send, B: Writer + Send, C: 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, (A, B, C): 'async_trait,

Source§

impl<A, B> Writer for (A, B)
where A: Writer + Send, B: 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, (A, B): 'async_trait,

Source§

impl<A> Writer for (A,)
where A: 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, (A,): 'async_trait,

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 CoolError

实现 Salvo 的错误处理

Source§

impl Writer for NamedFile

Source§

impl Writer for ParseError

Source§

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

Source§

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