#[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,
pub language: Option<&'a [LanguageRange]>,
}Expand description
The /query arguments (RFC 8620 §5.5) passed to
JmapReads::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.
language: Option<&'a [LanguageRange]>language (draft-atwood-jmap-updates-00 §4.2.2): sort and filter
on a localizable property (JmapObject::LOCALIZABLE) compare the
value /get with these ranges returns
(jmap_types::i18n::localized_value), not the base value. None
compares stored values. Set only for an account whose
JmapAccounts::i18n_info is Some; such a backend MUST honour it.
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.
Sourcepub fn language(self, language: Option<&'a [LanguageRange]>) -> Self
pub fn language(self, language: Option<&'a [LanguageRange]>) -> Self
Set language.