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

pub struct Form<T>(pub T);

Form data helper (application/x-www-form-urlencoded)

Can be use to extract url-encoded data from the request body, or send url-encoded data as the response.


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

FormConfig allows to configure extraction process.


use actix_web::web;
use serde_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)


The Form type also allows you to respond with well-formed url-encoded data: simply return a value of type Form where T is the type to be url-encoded. The type must implement serde::Serialize;


use actix_web::*;
use serde_derive::Serialize;

struct SomeForm {
    name: String,
    age: u8

// Will return a 200 response with header
// `Content-Type: application/x-www-form-urlencoded`
// and body "name=actix&age=123"
fn index() -> web::Form<SomeForm> {
    web::Form(SomeForm {
        name: "actix".into(),
        age: 123


impl<T> Form<T>[src]

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

Deconstruct to an inner value

Trait Implementations

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

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

type Target = T

The resulting type after dereferencing.

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

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

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

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

type Config = FormConfig

Configuration for this extractor

type Error = Error

The associated error which can be returned.

type Future = LocalBoxFuture<'static, Result<Self, Error>>

Future that resolves to a Self

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

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

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

impl<T: Serialize> Responder for Form<T>[src]

type Error = Error

The associated error which can be returned.

type Future = Ready<Result<Response, Error>>

The future response value.

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T, A, P> Access<T> for P where
    A: Access<T>,
    P: Deref<Target = A>, 

type Guard = <A as Access<T>>::Guard

A guard object containing the value and keeping it alive. Read more

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T, A> DynAccess<T> for A where
    A: Access<T>,
    <A as Access<T>>::Guard: 'static, 

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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