Struct actix_form_data::Form [−][src]
A structure that defines the fields expected in form data
Example
let form = Form::new() .field("field-name", Field::text()) .field("second-field", Field::int()) .field("third-field", Field::float()) .field("fifth-field", Field::file(|_, _, _| async move { Ok(None) as Result<_, std::convert::Infallible> })) .field( "map-field", Field::map() .field("sub-field", Field::text()) .field("sub-field-two", Field::text()) .finalize() ) .field( "array-field", Field::array(Field::text()) );
Implementations
impl Form
[src]
pub fn new() -> Self
[src]
Create a new form
If you wish to provide your own executor, use the with_executor
method.
Default values are as follows
- max_fields: 100
- max_field_size: 10_000 bytes
- max_files: 20
- max_files_size: 10_000_000 bytes
pub fn transform_error(
mut self: Self,
f: impl Fn(Error) -> Error + Send + Sync + 'static
) -> Self
[src]
mut self: Self,
f: impl Fn(Error) -> Error + Send + Sync + 'static
) -> Self
Add an optional error handler to transform errors produced by the middleware
pub fn max_fields(mut self: Self, max: u32) -> Self
[src]
Set the maximum number of fields allowed in the upload
The upload will error if too many fields are provided.
pub fn max_field_size(mut self: Self, max: usize) -> Self
[src]
Set the maximum size of a field (in bytes)
The upload will error if a provided field is too large.
pub fn max_files(mut self: Self, max: u32) -> Self
[src]
Set the maximum number of files allowed in the upload
THe upload will error if too many files are provided.
pub fn max_file_size(mut self: Self, max: usize) -> Self
[src]
Set the maximum size for files (in bytes)
The upload will error if a provided file is too large.
pub fn field(mut self: Self, name: &str, field: Field) -> Self
[src]
Trait Implementations
impl Clone for Form
[src]
impl Debug for Form
[src]
impl<S> Transform<S, ServiceRequest> for Form where
S: Service<ServiceRequest, Error = Error>,
S::Future: 'static,
[src]
S: Service<ServiceRequest, Error = Error>,
S::Future: 'static,
type Response = S::Response
Responses given by the service.
type Error = S::Error
Errors produced by the service.
type InitError = ()
Errors produced while building a transform service.
type Transform = MultipartMiddleware<S>
The TransformService
value created by this factory
type Future = Ready<Result<Self::Transform, Self::InitError>>
The future response value.
fn new_transform(&self, service: S) -> Self::Future
[src]
pub fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, Req, F, E> where
F: Fn(Self::InitError) -> E + Clone,
F: Fn(Self::InitError) -> E + Clone,
Auto Trait Implementations
impl !RefUnwindSafe for Form
[src]
impl Send for Form
[src]
impl Sync for Form
[src]
impl Unpin for Form
[src]
impl !UnwindSafe for Form
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,