pub struct MultipartForm<T>(pub T);
Expand description
Multipart data extractor (multipart/form-data
).
Can be used to extract multipart data from the request body.
MultipartFormConfig allows you to configure extraction process.
Example
First define a structure to represent the form that implements FromMultipart
traits.
Then use the extractor in your route.
#[derive(FromMultipart)]
struct Upload {
description: String,
image: MultipartFile,
}
use std::io::Read;
async fn route(form: MultipartForm<Upload>) -> impl Responder {
format!("Received image of size: {}", form.image.size)
}
Tuple Fields
0: T
Implementations
Trait Implementations
impl<T> FromRequest for MultipartForm<T> where
T: TryFrom<Multiparts, Error = Error> + 'static,
impl<T> FromRequest for MultipartForm<T> where
T: TryFrom<Multiparts, Error = Error> + 'static,
type Error = Error
type Error = Error
The associated error which can be returned.
type Config = MultipartFormConfig
type Config = MultipartFormConfig
Configuration for this extractor
Convert request to a Self
Convert request to a Self Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for MultipartForm<T> where
T: RefUnwindSafe,
impl<T> Send for MultipartForm<T> where
T: Send,
impl<T> Sync for MultipartForm<T> where
T: Sync,
impl<T> Unpin for MultipartForm<T> where
T: Unpin,
impl<T> UnwindSafe for MultipartForm<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. 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