Skip to main content

FromMultipart

Trait FromMultipart 

Source
pub trait FromMultipart: Sized {
    // Required method
    fn from_multipart<'life0, 'async_trait>(
        multipart: &'life0 mut Multipart,
        max_file_size: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for parsing a struct from multipart/form-data.

Implement this trait (or derive it with #[derive(FromMultipart)]) to describe how multipart fields map to struct fields. The MultipartForm extractor calls this automatically during request extraction.

Required Methods§

Source

fn from_multipart<'life0, 'async_trait>( multipart: &'life0 mut Multipart, max_file_size: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Parse multipart into Self, enforcing max_file_size on every file field when Some.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§