Refactor: Split HasValidate implementations for four different extractors into multiple files and export them using feature flags
This commit is contained in:
21
src/query.rs
Normal file
21
src/query.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
//! # Implementation of the `HasValidate` trait for the `Query` extractor.
|
||||
//!
|
||||
|
||||
use crate::{HasValidate, ValidRejection};
|
||||
use axum::extract::rejection::QueryRejection;
|
||||
use axum::extract::Query;
|
||||
use validator::Validate;
|
||||
|
||||
impl<T: Validate> HasValidate for Query<T> {
|
||||
type Validate = T;
|
||||
type Rejection = QueryRejection;
|
||||
fn get_validate(&self) -> &T {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<QueryRejection> for ValidRejection<QueryRejection> {
|
||||
fn from(value: QueryRejection) -> Self {
|
||||
Self::Inner(value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user