[−][src]Trait roa::body::PowerBody
A context extension to read/write body more simply.
Required methods
#[must_use]fn read<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
read request body as Bytes.
#[must_use]fn read_json<'life0, 'async_trait, B>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
This is supported on
feature="json"
only.read request body as "json".
#[must_use]fn read_form<'life0, 'async_trait, B>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
This is supported on
feature="urlencoded"
only.read request body as "urlencoded form".
fn write_json<B>(&mut self, data: &B) -> Result where
B: Serialize,
B: Serialize,
This is supported on
feature="json"
only.write object to response body as "application/json"
fn render<B>(&mut self, data: &B) -> Result where
B: Template,
B: Template,
This is supported on
feature="template"
only.write object to response body as "text/html; charset=utf-8"
fn write<B>(&mut self, data: B) where
B: Into<Bytes>,
B: Into<Bytes>,
write object to response body as "text/plain"
fn write_reader<B>(&mut self, reader: B) where
B: 'static + AsyncRead + Unpin + Sync + Send,
B: 'static + AsyncRead + Unpin + Sync + Send,
write object to response body as "application/octet-stream"
#[must_use]fn write_file<'life0, 'async_trait, P>(
&'life0 mut self,
path: P,
typ: DispositionType
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: Send + AsRef<Path>,
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 mut self,
path: P,
typ: DispositionType
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: Send + AsRef<Path>,
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
This is supported on
feature="file"
only.write object to response body as extension name of file
Implementors
impl<S: State> PowerBody for Context<S>
[src]
fn read<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read_json<'life0, 'async_trait, B>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn read_form<'life0, 'async_trait, B>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: DeserializeOwned,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn write_json<B>(&mut self, data: &B) -> Result where
B: Serialize,
[src]
B: Serialize,
fn render<B>(&mut self, data: &B) -> Result where
B: Template,
[src]
B: Template,
fn write<B>(&mut self, data: B) where
B: Into<Bytes>,
[src]
B: Into<Bytes>,
fn write_reader<B>(&mut self, reader: B) where
B: 'static + AsyncRead + Unpin + Sync + Send,
[src]
B: 'static + AsyncRead + Unpin + Sync + Send,
fn write_file<'life0, 'async_trait, P>(
&'life0 mut self,
path: P,
typ: DispositionType
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: Send + AsRef<Path>,
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
path: P,
typ: DispositionType
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: Send + AsRef<Path>,
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,