pub struct ValidatedMultipartForm<T: Validate>(pub T);
Expand description
Validated extractor for a HTTP Multipart request
Example
First define a structure to represent the form that implements FromMultipart
and
validator::Validate
traits. Then use the extractor in your route
#[derive(FromMultipart, Validate)]
struct MultipartUpload {
#[validate(length(max = 4096))]
description: String,
image: MultipartFile,
}
async fn route(
form: ValidatedMultipartForm<MultipartUpload>,
) -> HttpResponse {
let img_bytes = std::fs::read(form.image.file.path()).unwrap();
Tuple Fields
0: T
Implementations
Trait Implementations
impl<T> FromRequest for ValidatedMultipartForm<T> where
T: TryFrom<Multiparts, Error = GetError> + Validate + 'static,
impl<T> FromRequest for ValidatedMultipartForm<T> where
T: TryFrom<Multiparts, Error = GetError> + Validate + 'static,
Auto Trait Implementations
impl<T> RefUnwindSafe for ValidatedMultipartForm<T> where
T: RefUnwindSafe,
impl<T> Send for ValidatedMultipartForm<T> where
T: Send,
impl<T> Sync for ValidatedMultipartForm<T> where
T: Sync,
impl<T> Unpin for ValidatedMultipartForm<T> where
T: Unpin,
impl<T> UnwindSafe for ValidatedMultipartForm<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