[][src]Struct actix_web::web::Form

pub struct Form<T>(pub T);

Extract typed information from the request's body.

To extract typed information from request's body, the type T must implement the Deserialize trait from serde.

FormConfig allows to configure extraction process.

Example

#[macro_use] extern crate serde_derive;
use actix_web::{web, App};

#[derive(Deserialize)]
struct FormData {
    username: String,
}

/// Extract form data using serde.
/// This handler get called only if content type is *x-www-form-urlencoded*
/// and content of the request could be deserialized to a `FormData` struct
fn index(form: web::Form<FormData>) -> String {
    format!("Welcome {}!", form.username)
}

Methods

impl<T> Form<T>[src]

pub fn into_inner(self) -> T[src]

Deconstruct to an inner value

Trait Implementations

impl<T> FromRequest for Form<T> where
    T: DeserializeOwned + 'static, 
[src]

type Config = FormConfig

Configuration for this extractor

type Error = Error

The associated error which can be returned.

type Future = Box<dyn Future<Item = Self, Error = Error>>

Future that resolves to a Self

fn extract(req: &HttpRequest) -> Self::Future[src]

Convert request to a Self Read more

fn configure<F>(f: F) -> Self::Config where
    F: FnOnce(Self::Config) -> Self::Config
[src]

Create and configure config instance.

impl<T: PartialEq> PartialEq<Form<T>> for Form<T>[src]

impl<T: PartialOrd> PartialOrd<Form<T>> for Form<T>[src]

impl<T: Eq> Eq for Form<T>[src]

impl<T: Ord> Ord for Form<T>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T> DerefMut for Form<T>[src]

impl<T> Deref for Form<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: Display> Display for Form<T>[src]

impl<T: Debug> Debug for Form<T>[src]

Auto Trait Implementations

impl<T> Unpin for Form<T> where
    T: Unpin

impl<T> Sync for Form<T> where
    T: Sync

impl<T> Send for Form<T> where
    T: Send

impl<T> RefUnwindSafe for Form<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for Form<T> where
    T: UnwindSafe

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[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.

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

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

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

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,