pub struct Query<T>(pub T);Expand description
A wrapper type for URL query parameter deserialization.
This type can be used standalone for convenient query string parsing,
and when the axum feature is enabled, it implements Axum’s
FromRequestParts trait for extracting query parameters from the URL.
Unlike Form<T>, Query<T> does not consume the request body and can
be used alongside other extractors.
§Example
use facet::Facet;
use facet_urlencoded::Query;
#[derive(Debug, Facet)]
struct SearchParams {
q: String,
page: u64,
}
// Wrap a value
let query = Query(SearchParams {
q: "rust".to_string(),
page: 1,
});
// Access the inner value
println!("Search query: {}", query.q);Tuple Fields§
§0: TImplementations§
Source§impl<T> Query<T>
impl<T> Query<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the wrapper and return the inner value.
Trait Implementations§
Source§impl<T: Ord> Ord for Query<T>
impl<T: Ord> Ord for Query<T>
Source§impl<T: PartialOrd> PartialOrd for Query<T>
impl<T: PartialOrd> PartialOrd for Query<T>
impl<T: Copy> Copy for Query<T>
impl<T: Eq> Eq for Query<T>
impl<T> StructuralPartialEq for Query<T>
Auto Trait Implementations§
impl<T> Freeze for Query<T>where
T: Freeze,
impl<T> RefUnwindSafe for Query<T>where
T: RefUnwindSafe,
impl<T> Send for Query<T>where
T: Send,
impl<T> Sync for Query<T>where
T: Sync,
impl<T> Unpin for Query<T>where
T: Unpin,
impl<T> UnwindSafe for Query<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