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
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())
);
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.
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.
Create a new form with a given executor
This executor is used to stream files onto the filesystem.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
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
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static