Struct actix_web::dev::ExtractorConfig [] [src]

pub struct ExtractorConfig<S: 'static, T: FromRequest<S>> { /* fields omitted */ }

Extractor configuration

Route::with() and Route::with_async() returns instance of the ExtractorConfig type. It could be used for extractor configuration.

In this example Form<FormData> configured.

#[macro_use] extern crate serde_derive;
use actix_web::{App, Form, Result, http};

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

fn index(form: Form<FormData>) -> Result<String> {
    Ok(format!("Welcome {}!", form.username))
}

fn main() {
    let app = App::new().resource(
       "/index.html", |r| {
           r.method(http::Method::GET)
             .with(index)
             .limit(4096);} // <- change form extractor configuration
    );
}

Same could be donce with multiple extractors

#[macro_use] extern crate serde_derive;
use actix_web::{App, Form, Path, Result, http};

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

fn index(data: (Path<(String,)>, Form<FormData>)) -> Result<String> {
    Ok(format!("Welcome {}!", data.1.username))
}

fn main() {
    let app = App::new().resource(
       "/index.html", |r| {
           r.method(http::Method::GET)
             .with(index)
             .1.limit(4096);} // <- change form extractor configuration
    );
}

Trait Implementations

impl<S: 'static, T: FromRequest<S>> Default for ExtractorConfig<S, T>
[src]

[src]

Returns the "default value" for a type. Read more

impl<S: 'static, T: FromRequest<S>> Clone for ExtractorConfig<S, T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<S: 'static, T: FromRequest<S>> AsRef<T::Config> for ExtractorConfig<S, T>
[src]

[src]

Performs the conversion.

impl<S: 'static, T: FromRequest<S>> Deref for ExtractorConfig<S, T>
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl<S: 'static, T: FromRequest<S>> DerefMut for ExtractorConfig<S, T>
[src]

[src]

Mutably dereferences the value.

Auto Trait Implementations

impl<S, T> !Send for ExtractorConfig<S, T>

impl<S, T> !Sync for ExtractorConfig<S, T>