[−][src]Trait roa_body::PowerBody
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,
&'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,
&'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,
&'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
)
&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,
&'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
Implementations on Foreign Types
impl<S: State> PowerBody for Context<S>
[src]
fn body<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'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,
[src]
&'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,
[src]
&'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
[src]
fn render<B: Template>(&mut self, data: &B) -> Result
[src]
fn write_text<B: Into<Bytes>>(&mut self, data: B)
[src]
fn write_octet<B: 'static + AsyncRead + Unpin + Sync + Send>(
&mut self,
reader: B
)
[src]
&mut self,
reader: B
)
fn write_file<'life0, 'async_trait, P: 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,
[src]
&'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,