[][src]Struct nebula_form::Form

pub struct Form(_);

Represents the entire contents of a submitted form.

Implementations

impl Form[src]

pub fn new() -> Form[src]

Creates a new empty form instance.

pub fn with_capacity(cap: usize) -> Form[src]

Creates a new empty form instance with the given capacity.

pub fn insert(&mut self, name: &str, field: Field) -> Option<Field>[src]

Adds a new Field to the Form. Returns the previous Field, if there was one.

pub fn remove(&mut self, name: &str) -> Option<Field>[src]

If a Field exists with the given name, it is removed and returned. Otherwise, nothing happens and None is returned.

pub fn clear(&mut self)[src]

Empties the contents of the Form.

pub fn get(&self, name: &str) -> Option<&Field>[src]

Returns a reference to the field contents, if the field exists.

pub fn extend(&mut self, iter: impl Iterator<Item = (String, Field)>)[src]

Append the contents of a map to the current Form. Fields that already exist will be overwritten.

pub fn extend_from_strings(
    &mut self,
    iter: impl Iterator<Item = (String, String)>
)
[src]

Append the contents of a map to the current Form, converting the String values to a Field::Text. Fields that already exist will be overwritten.

pub fn contains_field(&self, field: &str) -> bool[src]

Indicates whether this Form contains a field with the given name.

pub fn is_empty(&self) -> bool[src]

Indicates whether the Form is empty (i.e., has no fields).

pub fn len(&self) -> usize[src]

Returns the length of the Form (i.e., the number of fields).

pub fn iter(&self) -> impl Iterator<Item = (&String, &Field)>[src]

Returns an iterator over every field in the form.

pub fn iter_text(&self) -> impl Iterator<Item = (&String, &Field)>[src]

Returns an iterator over every text field in the form.

pub fn iter_files(&self) -> impl Iterator<Item = (&String, &Field)>[src]

Returns an iterator over every file field in the form.

pub fn to_url_encoded(&self) -> Result<String, String>[src]

Returns the Form to a URL encoded format, suitable for GET requests or the body of a Content-Type: application/x-www-form-urlencoded POST request.

pub fn to_multipart_bytes(&self, boundary: &[u8]) -> Vec<u8>[src]

Returns the Form in multipart format, i.e. the format suitable for the body of a request with Content-Type: multipart/form-data.

Trait Implementations

impl Debug for Form[src]

impl Default for Form[src]

impl From<HashMap<String, String, RandomState>> for Form[src]

impl PartialEq<Form> for Form[src]

impl StructuralPartialEq for Form[src]

Auto Trait Implementations

impl RefUnwindSafe for Form

impl Send for Form

impl Sync for Form

impl Unpin for Form

impl UnwindSafe for Form

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.