pub struct MultipartForm<T>(pub T);
Expand description

Multipart form extractor (multipart/form-data).

Can be used to extract a multipart form 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: File,
}

async fn route(form: MultipartForm<Upload>) -> impl Responder {
    format!("Received image of size: {}", form.image.size)
}

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.

Create a Self from request parts asynchronously.

Create a Self from request head asynchronously. Read more

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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Type of resource’s path returned in resource_path.

Should always be Self

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