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§
Sourcetype Future: Future<Output = Result<Self, MultipartError>>
type Future: Future<Output = Result<Self, MultipartError>>
Future that resolves to a Self
.
Required Methods§
Sourcefn read_field(
req: &'t HttpRequest,
field: Field,
limits: &'t mut Limits,
) -> Self::Future
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
impl<'t> FieldReader<'t> for Bytes
Source§impl<'t> FieldReader<'t> for TempFile
Available on crate feature tempfile
only.
impl<'t> FieldReader<'t> for TempFile
Available on crate feature
tempfile
only.