pub trait FromFormMultiple<'f>: Sized {
    type Item;

    fn push(&mut self, item: Self::Item);
    fn default() -> Self;
}
Available on crate feature from_form only.
Expand description

A trait for types that can be created from a form.

This is used exclusively for arrays. It is expected that you use the #[derive(FromForm)] attribute on your type. This will generate a from_form method that correctly parses the types from the form. This handles types that expect multiple key-value pairs with the same keys, such as for arrays. As such, this trait is automatically implemented for any type T such that T: Default + Extend<V> + IntoIterator<Item = V>. This should cover all cases, and you should not need to implement (or use) this.

Required Associated Types§

The item type that is being collected into Self.

Required Methods§

Given for a key-value pair, adds the value to self. This also has the side effect of parsing the item into the correct type (using its corresponding FromFormValue implementation).

Return the default (empty) collection of Self. This should just be Default::default.

Implementors§