Struct FormConfig
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§
§impl FormConfig
impl FormConfig
pub fn limit(self, limit: usize) -> FormConfig
pub fn limit(self, limit: usize) -> FormConfig
Set maximum accepted payload size. By default this limit is 16kB.
pub fn error_handler<F>(self, f: F) -> FormConfigwhere
F: Fn(UrlencodedError, &HttpRequest) -> Error + 'static,
pub fn error_handler<F>(self, f: F) -> FormConfigwhere
F: Fn(UrlencodedError, &HttpRequest) -> Error + 'static,
Set custom error handler
Trait Implementations§
§impl Clone for FormConfig
impl Clone for FormConfig
§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 more§impl Default for FormConfig
impl Default for FormConfig
§fn default() -> FormConfig
fn default() -> FormConfig
Returns the “default value” for a type. Read more
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
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
)