[][src]Enum nebula_form::Field

pub enum Field {
    Text(String),
    File(FormFile),
}

Represents the contents of a single field of the submitted form.

A File field corresponds to HTML form fields with type="file", while Text fields correspond to all others, which can be represented as a string.

Variants

Text(String)
File(FormFile)

Implementations

impl Field[src]

pub fn into_text(self) -> Option<String>[src]

Returns an Option containing the text of the field as an owned value, if it is not a File.

pub fn into_file(self) -> Option<FormFile>[src]

Returns an Option containing the file from the field as an owned value, if it is a File.

pub fn as_text(&self) -> Option<&str>[src]

Returns an Option containing the text of the field, if it is not a File.

pub fn as_file(&self) -> Option<&FormFile>[src]

Returns an Option containing the file from the field, if it is a File.

pub fn contents_as<T, E>(&self) -> Result<T, Error> where
    E: Display + Sized,
    T: FromStr<Err = E>, 
[src]

Attmpts to return the field contents as an instance of type T if the field is Field::Text, or Ok(None) for Field::File.

Trait Implementations

impl Clone for Field[src]

impl Debug for Field[src]

impl PartialEq<Field> for Field[src]

impl StructuralPartialEq for Field[src]

Auto Trait Implementations

impl RefUnwindSafe for Field

impl Send for Field

impl Sync for Field

impl Unpin for Field

impl UnwindSafe for Field

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.