[][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,
    // 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: usize

Methods

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.

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 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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

impl<T> Erased for T