Skip to main content

filter_arg

Function filter_arg 

Source
pub fn filter_arg<T>(
    args: &mut Map<String, Value>,
) -> Result<Option<T>, JmapError>
Expand description

Remove and decode the optional filter argument of a hand-written /query or /queryChanges handler (RFC 8620 §5.5).

Absent or null yields None. A value that is not a JSON object is not a filter at all and yields invalidArguments. An object that does not decode as T yields unsupportedFilter (“The “filter” is syntactically valid, but the server cannot process it“) with the serde message as its description. With deny_unknown_fields on the filter types, that covers an unknown or misspelt condition property at any depth and an operator tree sent to an object whose filter is a bare condition.

§Errors

  • invalidArguments if filter is present, not null, and not a JSON object.
  • unsupportedFilter, with the serde message as its description, if it is an object that does not decode as T.