pub struct FormConfig { /* private fields */ }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
.state(
web::types::FormConfig::default().limit(4097)
)
.route(web::get().to(index))
);
}Implementations§
Trait Implementations§
Source§impl Clone for FormConfig
impl Clone for FormConfig
Source§fn clone(&self) -> FormConfig
fn clone(&self) -> FormConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FormConfig
impl Debug for FormConfig
Auto Trait Implementations§
impl Freeze for FormConfig
impl RefUnwindSafe for FormConfig
impl Send for FormConfig
impl Sync for FormConfig
impl Unpin for FormConfig
impl UnwindSafe for FormConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more