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
max_fields: u32
max_field_size: usize
max_files: u32
max_file_size: usize
pool: ArcExecutor
Methods
impl Form
[src]
impl Form
pub fn new() -> Self
[src]
pub fn new() -> Self
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]
pub fn max_fields(self, max: u32) -> Self
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]
pub fn max_field_size(self, max: usize) -> Self
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]
pub fn max_files(self, max: u32) -> Self
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]
pub fn max_file_size(self, max: usize) -> Self
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<Future<Item = (), Error = ()> + Send>> + Send + Sync + Clone + 'static,
[src]
pub fn from_executor<E>(executor: E) -> Self where
E: Executor<Box<Future<Item = (), Error = ()> + Send>> + Send + Sync + Clone + 'static,
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]
pub fn field(self, name: &str, field: Field) -> Self
Trait Implementations
impl Clone for Form
[src]
impl Clone for Form
fn clone(&self) -> Form
[src]
fn clone(&self) -> Form
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Form
[src]
impl Debug for Form