#[non_exhaustive]pub struct QueryParams<'a, O: QueryObject> {
pub filter: Option<&'a O::Filter>,
pub sort: Option<&'a [O::Comparator]>,
pub limit: Option<u64>,
pub position: i64,
pub anchor: Option<&'a Id>,
pub anchor_offset: i64,
}Expand description
The /query arguments (RFC 8620 §5.5) passed to
JmapBackend::query_objects, after accountId.
#[non_exhaustive] so a new RFC or extension argument is a new field,
not a breaking change to every backend (bd:JMAP-wf92.7). Backends read
the public fields; callers build one with QueryParams::new and the
setters:
let filter = serde_json::json!({"text": "hello"});
let params = QueryParams::<Foo>::new().filter(Some(&filter)).limit(Some(50));
assert_eq!(params.position, 0);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.filter: Option<&'a O::Filter>filter; None matches every object.
sort: Option<&'a [O::Comparator]>sort; None leaves the order to the server.
limit: Option<u64>limit; None means no client limit.
position: i64position. Negative values count from the end of the results
(RFC 8620 §5.5); ignored when anchor is set.
anchor: Option<&'a Id>anchor: start the page at this id’s index instead of position.
anchor_offset: i64anchorOffset, added to the anchor’s index; ignored without an
anchor.
Implementations§
Source§impl<'a, O: QueryObject> QueryParams<'a, O>
impl<'a, O: QueryObject> QueryParams<'a, O>
Sourcepub fn new() -> Self
pub fn new() -> Self
The RFC 8620 §5.5 defaults: no filter, sort, limit or anchor, and
position and anchorOffset 0.
Sourcepub fn sort(self, sort: Option<&'a [O::Comparator]>) -> Self
pub fn sort(self, sort: Option<&'a [O::Comparator]>) -> Self
Set sort.
Sourcepub fn anchor_offset(self, anchor_offset: i64) -> Self
pub fn anchor_offset(self, anchor_offset: i64) -> Self
Set anchor_offset.