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

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

The associated error which can be returned.

Future that resolves to a Self

Configuration for this extractor

Convert request to a Self

Convert request to a Self Read more

Create and configure config instance.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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