pub struct ValidatedQuery<T>(pub T);Expand description
Query parameters extractor with automatic validation
This extractor deserializes query parameters and automatically validates them.
§Example
use lmrc_http_common::extractors::ValidatedQuery;
use serde::Deserialize;
use validator::Validate;
#[derive(Deserialize, Validate)]
struct Pagination {
#[validate(range(min = 1, max = 100))]
page: u32,
#[validate(range(min = 1, max = 100))]
per_page: u32,
}
async fn list_items(
ValidatedQuery(params): ValidatedQuery<Pagination>
) -> &'static str {
"Items list"
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for ValidatedQuery<T>
impl<T: Clone> Clone for ValidatedQuery<T>
Source§fn clone(&self) -> ValidatedQuery<T>
fn clone(&self) -> ValidatedQuery<T>
Returns a duplicate 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 moreSource§impl<T: Debug> Debug for ValidatedQuery<T>
impl<T: Debug> Debug for ValidatedQuery<T>
Source§impl<T: Default> Default for ValidatedQuery<T>
impl<T: Default> Default for ValidatedQuery<T>
Source§fn default() -> ValidatedQuery<T>
fn default() -> ValidatedQuery<T>
Returns the “default value” for a type. Read more
Source§impl<T, S> FromRequest<S> for ValidatedQuery<T>
impl<T, S> FromRequest<S> for ValidatedQuery<T>
impl<T: Copy> Copy for ValidatedQuery<T>
Auto Trait Implementations§
impl<T> Freeze for ValidatedQuery<T>where
T: Freeze,
impl<T> RefUnwindSafe for ValidatedQuery<T>where
T: RefUnwindSafe,
impl<T> Send for ValidatedQuery<T>where
T: Send,
impl<T> Sync for ValidatedQuery<T>where
T: Sync,
impl<T> Unpin for ValidatedQuery<T>where
T: Unpin,
impl<T> UnwindSafe for ValidatedQuery<T>where
T: UnwindSafe,
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Add request id header and extension. Read more
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Add request id header and extension, using
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Propgate request ids from requests to responses. Read more
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
Propgate request ids from requests to responses, using
x-request-id as the header name. Read more