Struct actix_web::web::FormConfig
source · pub struct FormConfig { /* private fields */ }
Expand description
Form
extractor configuration.
use actix_web::{post, web, App, FromRequest, Result};
use serde::Deserialize;
#[derive(Deserialize)]
struct Info {
username: String,
}
// Custom `FormConfig` is applied to App.
// Max payload size for URL encoded forms is set to 4kB.
#[post("/")]
async fn index(form: web::Form<Info>) -> Result<String> {
Ok(format!("Welcome {}!", form.username))
}
App::new()
.app_data(web::FormConfig::default().limit(4096))
.service(index);
Implementations§
source§impl FormConfig
impl FormConfig
sourcepub fn limit(self, limit: usize) -> Self
pub fn limit(self, limit: usize) -> Self
Set maximum accepted payload size. By default this limit is 16kB.
sourcepub fn error_handler<F>(self, f: F) -> Self
pub fn error_handler<F>(self, f: F) -> Self
Set custom error handler
Trait Implementations§
source§impl Clone for FormConfig
impl Clone for FormConfig
source§fn clone(&self) -> FormConfig
fn clone(&self) -> FormConfig
Returns a copy 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 moreAuto 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)