Expand description
Parsing and validation of HTTP forms and fields.
See the forms guide for general form support documentation.
Field Wire Format
Rocket’s field wire format is a flexible, non-self-descriptive, text-based encoding of arbitrarily nested structure keys and their corresponding values. The general grammar is:
field := name ('=' value)?
name := key*
key := indices
| '[' indices ']'
| '.' indices
indices := index (':' index)*
index := STRING except ':', ']'
value := STRING
Each field name consists of any number of keys and at most one value.
Keys are delimited by [ or .. A key consists of indices delimited by
:.
The meaning of a key or index is type-dependent, hence the format is
non-self-descriptive. Any structure can be described by this format. The
delimiters ., [, :, and ] have no semantic meaning.
Some examples of valid fields are:
=key=valuekey[]=value.0=value[0]=valuepeople[].name=Bobbob.cousin.names[]=Bobmap[k:1]=Bobpeople[bob]nickname=Stan
See FromForm for full details on push-parsing and complete examples, and
Form for how to accept forms in a request handler.
Modules
- Form error types.
- Types for field names, name keys, and key indices.
- Form field validation routines.
Structs
- A form context containing received fields, values, and encountered errors.
- An infallible form guard that records form fields and errors during parsing.
- A multipart form field with an underlying data stream.
- A form error, potentially tied to a specific form field.
- A collection of
Errors. - A data guard for
FromFormtypes. - A form guard for parsing form types leniently.
- Form guard options.
- A form guard for parsing form types strictly.
- A form field with a string value.
Traits
- Trait implemented by form guards: types parseable from HTTP forms.
- Implied form guard (
FromForm) for parsing a single form field.
Type Aliases
- Type alias for
Resultwith an error type ofErrors.