Trait FieldReader

Source
pub trait FieldReader<'t>: Sized + Any {
    type Future: Future<Output = Result<Self, MultipartError>>;

    // Required method
    fn read_field(
        req: &'t HttpRequest,
        field: Field,
        limits: &'t mut Limits,
    ) -> Self::Future;
}
Expand description

Trait that data types to be used in a multipart form struct should implement.

It represents an asynchronous handler that processes a multipart field to produce Self.

Required Associated Types§

Source

type Future: Future<Output = Result<Self, MultipartError>>

Future that resolves to a Self.

Required Methods§

Source

fn read_field( req: &'t HttpRequest, field: Field, limits: &'t mut Limits, ) -> Self::Future

The form will call this function to handle the field.

§Panics

When reading the field payload using its Stream implementation, polling (manually or via next()/try_next()) may panic after the payload is exhausted. If this is a problem for your implementation of this method, you should fuse() the Field first.

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§

Source§

impl<'t> FieldReader<'t> for Bytes

Source§

type Future = Pin<Box<dyn Future<Output = Result<Bytes, Error>> + 't>>

Source§

impl<'t> FieldReader<'t> for TempFile

Available on crate feature tempfile only.
Source§

type Future = Pin<Box<dyn Future<Output = Result<TempFile, Error>> + 't>>

Source§

impl<'t, T> FieldReader<'t> for Json<T>
where T: DeserializeOwned + 'static,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Json<T>, Error>> + 't>>

Source§

impl<'t, T> FieldReader<'t> for Text<T>
where T: DeserializeOwned + 'static,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Text<T>, Error>> + 't>>