Struct actix_form_data::Form[][src]

pub struct Form { /* fields omitted */ }
Expand description

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

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

Add an optional error handler to transform errors produced by the middleware

Set the maximum number of fields allowed in the upload

The upload will error if too many fields are provided.

Set the maximum size of a field (in bytes)

The upload will error if a provided field is too large.

Set the maximum number of files allowed in the upload

THe upload will error if too many files are provided.

Set the maximum size for files (in bytes)

The upload will error if a provided file is too large.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Responses produced by the service.

Errors produced by the service.

Errors produced while building a transform service.

The TransformService value created by this factory

The future response value.

Creates and returns a new Transform component, asynchronously

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.