[−][src]Trait roa::body::PowerBody
A context extension to read/write body more simply.
Required methods
fn request_type<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
try to get mime content type of request.
fn response_type<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
try to get mime content type of response.
fn body_buf<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
read request body as Vec
fn read<'life0, 'async_trait, B: DeserializeOwned>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
read request body by Content-Type.
fn read_json<'life0, 'async_trait, B: DeserializeOwned>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + '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 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
read request body as "application/x-www-form-urlencoded".
fn write_json<'life0, 'life1, 'async_trait, B: Serialize + Sync>(
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
write object to response body as "application/json; charset=utf-8"
fn render<'life0, 'life1, 'async_trait, B: Template + Sync>(
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
write object to response body as "text/html; charset=utf-8"
fn write_text<'life0, 'async_trait, S: ToString + Send>(
&'life0 self,
string: S
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
string: S
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
write object to response body as "text/plain; charset=utf-8"
fn write_octet<'life0, 'async_trait, B: 'static + BufRead + Unpin + Sync + Send>(
&'life0 self,
reader: B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
reader: B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
write object to response body as "application/octet-stream"
fn write_file<'life0, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result> + Send + '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 request_type<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn response_type<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Option<Result<Mime>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn body_buf<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn read<'life0, 'async_trait, B: DeserializeOwned>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn read_json<'life0, 'async_trait, B: DeserializeOwned>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn read_form<'life0, 'async_trait, B: DeserializeOwned>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<B>> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn write_json<'life0, 'life1, 'async_trait, B: Serialize + Sync>(
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn render<'life0, 'life1, 'async_trait, B: Template + Sync>(
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data: &'life1 B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn write_text<'life0, 'async_trait, Str: ToString + Send>(
&'life0 self,
string: Str
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
Str: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
string: Str
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
Str: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn write_octet<'life0, 'async_trait, B: 'static + BufRead + Unpin + Sync + Send>(
&'life0 self,
reader: B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
reader: B
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn write_file<'life0, 'async_trait, P: AsRef<Path> + Send>(
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
path: P
) -> Pin<Box<dyn Future<Output = Result> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,