[−][src]Struct serde_qs::actix::QsQueryConfig
Query extractor configuration
#[macro_use] extern crate serde_derive; extern crate actix_web; use actix_web::{error, web, App, FromRequest, HttpResponse}; use serde_qs::actix::QsQuery; use serde_qs::Config as QsConfig; #[derive(Deserialize)] struct Info { username: String, } /// deserialize `Info` from request's querystring fn index(info: QsQuery<Info>) -> HttpResponse { format!("Welcome {}!", info.username).into() } fn main() { let app = App::new().service( web::resource("/index.html").app_data( // change query extractor configuration QsQuery::<Info>::configure(|cfg| { cfg.error_handler(|err, req| { // <- create custom error response error::InternalError::from_response( err, HttpResponse::Conflict().finish()).into() }) .qs_config(QsConfig::default()) })) .route(web::post().to(index)) ); }
Implementations
impl QsQueryConfig
[src]
pub fn error_handler<F>(self, f: F) -> Self where
F: Fn(QsError, &HttpRequest) -> ActixError + Send + Sync + 'static,
[src]
F: Fn(QsError, &HttpRequest) -> ActixError + Send + Sync + 'static,
Set custom error handler
pub fn qs_config(self, config: QsConfig) -> Self
[src]
Set custom serialization parameters
Trait Implementations
impl Default for QsQueryConfig
[src]
Auto Trait Implementations
impl !RefUnwindSafe for QsQueryConfig
impl Send for QsQueryConfig
impl Sync for QsQueryConfig
impl Unpin for QsQueryConfig
impl !UnwindSafe for QsQueryConfig
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,