Struct actix_web::dev::JsonConfig [] [src]

pub struct JsonConfig { /* fields omitted */ }

Json extractor configuration

#[macro_use] extern crate serde_derive;
use actix_web::{App, Json, Result, http};

#[derive(Deserialize)]
struct Info {
    username: String,
}

/// deserialize `Info` from request's body, max payload size is 4kb
fn index(info: Json<Info>) -> Result<String> {
    Ok(format!("Welcome {}!", info.username))
}

fn main() {
    let app = App::new().resource(
       "/index.html", |r| {
           r.method(http::Method::POST)
              .with(index)
              .limit(4096);} // <- change json extractor configuration
    );
}

Methods

impl JsonConfig
[src]

Important traits for &'a mut W
[src]

Change max size of payload. By default max size is 256Kb

Trait Implementations

impl Default for JsonConfig
[src]

[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations

impl Send for JsonConfig

impl Sync for JsonConfig