From b6039b0bff0d1f4ec79a81a19fbdd95a7abbefac Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 10 May 2018 11:04:03 -0700 Subject: [PATCH] add doc string --- src/with.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/with.rs b/src/with.rs index dca600bbe..099bcea4f 100644 --- a/src/with.rs +++ b/src/with.rs @@ -9,6 +9,36 @@ use handler::{AsyncResult, AsyncResultItem, FromRequest, Handler, Responder}; use httprequest::HttpRequest; use httpresponse::HttpResponse; +/// 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` configured. +/// +/// ```rust +/// # extern crate actix_web; +/// #[macro_use] extern crate serde_derive; +/// use actix_web::{App, Form, Result, http}; +/// +/// #[derive(Deserialize)] +/// struct FormData { +/// username: String, +/// } +/// +/// fn index(form: Form) -> Result { +/// 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 +/// ); +/// } +/// ``` pub struct ExtractorConfig> { cfg: Rc>, }