Struct form_data::Form [] [src]

pub struct Form {
    pub max_fields: u32,
    pub max_field_size: usize,
    pub max_files: u32,
    pub max_file_size: usize,
    pub pool: ArcExecutor,
    // some fields omitted
}

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("fourth-field", Field::bytes())
    .field("fifth-field", Field::file(name_generator))
    .field(
        "map-field",
        Field::map()
            .field("sub-field", Field::text())
            .field("sub-field-two", Field::text())
            .finalize()
    )
    .field(
        "array-field",
        Field::array(Field::text())
    );

Fields

Methods

impl Form
[src]

[src]

Create a new form

This also creates a new CpuPool to be used to stream files onto the filesystem. If you wish to provide your own executor, use the from_executor method.

[src]

Set the maximum number of fields allowed in the upload

The upload will error if too many fields are provided.

[src]

Set the maximum size of a field (in bytes)

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

[src]

Set the maximum number of files allowed in the upload

THe upload will error if too many files are provided.

[src]

Set the maximum size for files (in bytes)

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

[src]

Create a new form with a given executor

This executor is used to stream files onto the filesystem.

[src]

Trait Implementations

impl Clone for Form
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Form
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Form

impl Sync for Form