Skip to main content

FromMultipart

Trait FromMultipart 

Source
pub trait FromMultipart: Sized {
    // Required method
    fn from_multipart(
        form: &mut MultipartForm,
    ) -> impl Future<Output = Result<Self>> + Send;

    // Provided method
    fn form_schema(generator: &mut SchemaGenerator) -> Schema { ... }
}
Expand description

Builds a value from a parsed multipart body.

Implemented by #[derive(FormModel)], which binds each field (text or file) and runs its validation.

Required Methods§

Source

fn from_multipart( form: &mut MultipartForm, ) -> impl Future<Output = Result<Self>> + Send

Binds Self from the parsed multipart form.

Provided Methods§

Source

fn form_schema(generator: &mut SchemaGenerator) -> Schema

Builds the OpenAPI/AsyncAPI schema for the form (overridden by the derive).

The default is a permissive object; #[derive(FormModel)] generates a precise schema with file fields marked as format: binary.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§