[][src]Trait roa_body::PowerBody

pub trait PowerBody {
    fn body<'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<B: Into<Bytes>>(&mut self, data: B);
fn write_octet<B: 'static + AsyncRead + Unpin + Sync + Send>(
        &mut self,
        reader: B
    );
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<'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 Bytes.

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"

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

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

fn write_text<B: Into<Bytes>>(&mut self, data: B)

write object to response body as "text/plain"

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

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...