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§
Sourcefn from_multipart(
form: &mut MultipartForm,
) -> impl Future<Output = Result<Self>> + Send
fn from_multipart( form: &mut MultipartForm, ) -> impl Future<Output = Result<Self>> + Send
Binds Self from the parsed multipart form.
Provided Methods§
Sourcefn form_schema(generator: &mut SchemaGenerator) -> Schema
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".