[][src]Trait roa_body::PowerBody

pub trait PowerBody: Content {
    fn body_bytes<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn read_json<'life0, 'async_trait, B: DeserializeOwned>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<B>> + 'async_trait>>
    where
        B: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn read_form<'life0, 'async_trait, B: DeserializeOwned>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<B>> + 'async_trait>>
    where
        B: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn write_json<B: Serialize>(&mut self, data: &B) -> Result;
fn render<B: Template>(&mut self, data: &B) -> Result;
fn write_text<S: ToString>(&mut self, string: S) -> Result;
fn write_octet<B: 'static + AsyncRead + Unpin + Sync + Send>(
        &mut self,
        reader: B
    ) -> Result;
fn write_file<'life0, 'async_trait, P: 'static + AsRef<Path>>(
        &'life0 mut self,
        path: P,
        typ: DispositionType
    ) -> Pin<Box<dyn Future<Output = Result> + 'async_trait>>
    where
        P: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; }

A context extension to read/write body more simply.

Required methods

fn body_bytes<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

read request body as Vec.

fn read_json<'life0, 'async_trait, B: DeserializeOwned>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + 'async_trait>> where
    B: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

read request body as "application/json".

fn read_form<'life0, 'async_trait, B: DeserializeOwned>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + 'async_trait>> where
    B: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

read request body as "application/x-www-form-urlencoded".

fn write_json<B: Serialize>(&mut self, data: &B) -> Result

write object to response body as "application/json; charset=utf-8"

fn render<B: Template>(&mut self, data: &B) -> Result

write object to response body as "text/html; charset=utf-8"

fn write_text<S: ToString>(&mut self, string: S) -> Result

write object to response body as "text/plain; charset=utf-8"

fn write_octet<B: 'static + AsyncRead + Unpin + Sync + Send>(
    &mut self,
    reader: B
) -> Result

write object to response body as "application/octet-stream"

fn write_file<'life0, 'async_trait, P: 'static + AsRef<Path>>(
    &'life0 mut self,
    path: P,
    typ: DispositionType
) -> Pin<Box<dyn Future<Output = Result> + 'async_trait>> where
    P: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 

write object to response body as extension name of file

Loading content...

Implementations on Foreign Types

impl<S: State> PowerBody for Context<S>[src]

Loading content...

Implementors

Loading content...