[][src]Struct actix_web::dev::PathConfig

pub struct PathConfig<S> { /* fields omitted */ }

Path extractor configuration

use actix_web::{error, http, App, HttpResponse, Path, Result};

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

fn main() {
    let app = App::new().resource("/index.html/{id}/{name}", |r| {
        r.method(http::Method::GET).with_config(index, |cfg| {
            cfg.0.error_handler(|err, req| {
                // <- create custom error response
                error::InternalError::from_response(err, HttpResponse::Conflict().finish()).into()
            });
        })
    });
}

Methods

impl<S> PathConfig<S>[src]

pub fn error_handler<F>(&mut self, f: F) -> &mut Self where
    F: Fn(Error, &HttpRequest<S>) -> Error + 'static, 
[src]

Set custom error handler

pub fn disable_decoding(&mut self) -> &mut Self[src]

Disable decoding of URL encoded special charaters from the path

Trait Implementations

impl<S> Default for PathConfig<S>[src]

Auto Trait Implementations

impl<S> !Send for PathConfig<S>

impl<S> !Sync for PathConfig<S>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T