pub struct Query<'a, T: 'static> { /* private fields */ }Expand description
A query builder for filtering, selecting, ordering, grouping, and aggregating data.
§Type Parameters
'a- The lifetime of the data being queriedT- The type of items in the collection
§Example
ⓘ
let products = vec![/* ... */];
let query = Query::new(&products)
.where_(Product::price_r(), |&price| price < 100.0)
.order_by_float(Product::price_r());Implementations§
Source§impl<'a, T: 'static> Query<'a, T>
impl<'a, T: 'static> Query<'a, T>
Sourcepub fn where_<F>(
self,
path: KeyPaths<T, F>,
predicate: impl Fn(&F) -> bool + 'static,
) -> Selfwhere
F: 'static,
pub fn where_<F>(
self,
path: KeyPaths<T, F>,
predicate: impl Fn(&F) -> bool + 'static,
) -> Selfwhere
F: 'static,
Sourcepub fn skip<'b>(&'b self, offset: usize) -> QueryWithSkip<'a, 'b, T>
pub fn skip<'b>(&'b self, offset: usize) -> QueryWithSkip<'a, 'b, T>
Sourcepub fn where_after_systemtime(
self,
path: KeyPaths<T, SystemTime>,
reference: SystemTime,
) -> Self
pub fn where_after_systemtime( self, path: KeyPaths<T, SystemTime>, reference: SystemTime, ) -> Self
Sourcepub fn where_before_systemtime(
self,
path: KeyPaths<T, SystemTime>,
reference: SystemTime,
) -> Self
pub fn where_before_systemtime( self, path: KeyPaths<T, SystemTime>, reference: SystemTime, ) -> Self
Sourcepub fn where_between_systemtime(
self,
path: KeyPaths<T, SystemTime>,
start: SystemTime,
end: SystemTime,
) -> Self
pub fn where_between_systemtime( self, path: KeyPaths<T, SystemTime>, start: SystemTime, end: SystemTime, ) -> Self
Source§impl<'a, T: 'static + Clone> Query<'a, T>
impl<'a, T: 'static + Clone> Query<'a, T>
Sourcepub fn order_by_desc<F>(&self, path: KeyPaths<T, F>) -> Vec<T>
pub fn order_by_desc<F>(&self, path: KeyPaths<T, F>) -> Vec<T>
Sourcepub fn order_by_float(&self, path: KeyPaths<T, f64>) -> Vec<T>
pub fn order_by_float(&self, path: KeyPaths<T, f64>) -> Vec<T>
Sourcepub fn order_by_float_desc(&self, path: KeyPaths<T, f64>) -> Vec<T>
pub fn order_by_float_desc(&self, path: KeyPaths<T, f64>) -> Vec<T>
Auto Trait Implementations§
impl<'a, T> Freeze for Query<'a, T>
impl<'a, T> !RefUnwindSafe for Query<'a, T>
impl<'a, T> !Send for Query<'a, T>
impl<'a, T> !Sync for Query<'a, T>
impl<'a, T> Unpin for Query<'a, T>
impl<'a, T> !UnwindSafe for Query<'a, T>
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