Struct actix_web::web::FormConfig [−][src]
pub struct FormConfig { /* fields omitted */ }
Expand description
Form extractor configuration
use actix_web::{web, App, FromRequest, Result};
use serde_derive::Deserialize;
#[derive(Deserialize)]
struct FormData {
username: String,
}
/// Extract form data using serde.
/// Custom configuration is used for this handler, max payload size is 4k
async fn index(form: web::Form<FormData>) -> Result<String> {
Ok(format!("Welcome {}!", form.username))
}
fn main() {
let app = App::new().service(
web::resource("/index.html")
// change `Form` extractor configuration
.app_data(
web::FormConfig::default().limit(4097)
)
.route(web::get().to(index))
);
}
Implementations
Change max size of payload. By default max size is 16Kb
pub fn error_handler<F>(self, f: F) -> Self where
F: Fn(UrlencodedError, &HttpRequest) -> Error + 'static,
pub fn error_handler<F>(self, f: F) -> Self where
F: Fn(UrlencodedError, &HttpRequest) -> Error + 'static,
Set custom error handler
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for FormConfig
impl !Send for FormConfig
impl !Sync for FormConfig
impl Unpin for FormConfig
impl !UnwindSafe for FormConfig
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more