Struct poem::web::Multipart [−][src]
pub struct Multipart { /* fields omitted */ }
This is supported on crate feature
multipart
only.Expand description
An extractor that parses multipart/form-data
requests commonly used with
file uploads.
Errors
Example
use poem::{
error::{BadRequest, Error},
web::Multipart,
Result,
};
async fn upload(mut multipart: Multipart) -> Result<()> {
while let Some(field) = multipart.next_field().await? {
let data = field.bytes().await.map_err(BadRequest)?;
println!("{} bytes", data.len());
}
Ok(())
}
Implementations
Yields the next Field
if available.
Trait Implementations
fn from_request<'life0, 'async_trait>(
req: &'a Request,
body: &'life0 mut RequestBody
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn from_request<'life0, 'async_trait>(
req: &'a Request,
body: &'life0 mut RequestBody
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
'a: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Extract from request head and body.
Auto Trait Implementations
impl !RefUnwindSafe for Multipart
impl !UnwindSafe for Multipart
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more