Skip to main content

modo_upload/
from_multipart.rs

1/// Trait for parsing a struct from `multipart/form-data`.
2///
3/// Implement this trait (or derive it with `#[derive(FromMultipart)]`) to
4/// describe how multipart fields map to struct fields.  The
5/// [`MultipartForm`](crate::MultipartForm) extractor calls this automatically during request
6/// extraction.
7pub trait FromMultipart: Sized {
8    /// Parse `multipart` into `Self`, enforcing `max_file_size` on every file
9    /// field when `Some`.
10    fn from_multipart(
11        multipart: &mut axum::extract::Multipart,
12        max_file_size: Option<usize>,
13    ) -> impl std::future::Future<Output = Result<Self, modo::Error>> + Send;
14}