[][src]Struct form_data::Form

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

max_fields: u32max_field_size: usizemax_files: u32max_file_size: usizepool: ArcExecutor

Methods

impl Form
[src]

pub fn new() -> Self
[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.

pub fn max_fields(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(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(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(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 from_executor<E>(executor: E) -> Self where
    E: Executor<Box<dyn Future<Item = (), Error = ()> + Send>> + Send + Sync + Clone + 'static, 
[src]

Create a new form with a given executor

This executor is used to stream files onto the filesystem.

pub fn field(self, name: &str, field: Field) -> Self
[src]

Trait Implementations

impl Clone for Form
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Form
[src]

Auto Trait Implementations

impl Send for Form

impl Sync for Form

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T