Trait MultipartCollect

Source
pub trait MultipartCollect: Sized {
    // Required methods
    fn limit(field_name: &str) -> Option<usize>;
    fn handle_field<'t>(
        req: &'t HttpRequest,
        field: Field,
        limits: &'t mut Limits,
        state: &'t mut State,
    ) -> LocalBoxFuture<'t, Result<(), MultipartError>>;
    fn from_state(state: State) -> Result<Self, MultipartError>;
}
Expand description

Trait that allows a type to be used in the MultipartForm extractor.

You should use the MultipartForm macro to derive this for your struct.

Required Methods§

Source

fn limit(field_name: &str) -> Option<usize>

An optional limit in bytes to be applied a given field name. Note this limit will be shared across all fields sharing the same name.

Source

fn handle_field<'t>( req: &'t HttpRequest, field: Field, limits: &'t mut Limits, state: &'t mut State, ) -> LocalBoxFuture<'t, Result<(), MultipartError>>

The extractor will call this function for each incoming field, the state can be updated with the processed field data.

Source

fn from_state(state: State) -> Result<Self, MultipartError>

Once all the fields have been processed and stored in the state, this is called to convert into the struct representation.

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§