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]
impl<S: 'static, T: FromRequest<S>> Clone for ExtractorConfig<S, T>
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
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]
impl<S: 'static, T: FromRequest<S>> Deref for ExtractorConfig<S, T>
[src]
type Target = T::Config
The resulting type after dereferencing.
fn deref(&self) -> &T::Config
[src]
Dereferences the value.