Trait axum_typed_multipart::TryFromField
source · pub trait TryFromField: Sized {
// Required method
fn try_from_field<'life0, 'async_trait>(
field: Field<'life0>,
limit_bytes: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Self, TypedMultipartError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Types that can be created from an instance of Field.
All fields for a given struct must implement this trait to be able to derive the TryFromMultipart trait.
Implementing this trait directly is not recommended since it requires the user to manually implement the size limit logic. Instead, implement the TryFromChunks trait and this trait will be implemented automatically.
Required Methods§
sourcefn try_from_field<'life0, 'async_trait>(
field: Field<'life0>,
limit_bytes: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Self, TypedMultipartError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn try_from_field<'life0, 'async_trait>(
field: Field<'life0>,
limit_bytes: Option<usize>
) -> Pin<Box<dyn Future<Output = Result<Self, TypedMultipartError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Consume the input Field to create the supplied type.
The limit_bytes
parameter is used to limit the size of the field. If
the field is larger than the limit, an error is returned.
Object Safety§
This trait is not object safe.