Struct ntex::web::types::FormConfig [−][src]
pub struct FormConfig { /* fields omitted */ }
Expand description
Form extractor configuration
use ntex::web::{self, App, Error, FromRequest};
#[derive(serde::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::types::Form<FormData>) -> Result<String, Error> {
Ok(format!("Welcome {}!", form.username))
}
fn main() {
let app = App::new().service(
web::resource("/index.html")
// change `Form` extractor configuration
.app_data(
web::types::FormConfig::default().limit(4097)
)
.route(web::get().to(index))
);
}
Implementations
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
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