Skip to main content

to_args

Function to_args 

Source
pub fn to_args<T: Serialize + ?Sized>(value: &T) -> Result<Value, ClientError>
Expand description

Serialize a method argument to a serde_json::Value for a JMAP method call’s arguments object.

Every extension client uses this to put a caller-supplied value (filter, sort, patch map, id list, params struct) into a request, so a value that cannot be represented as JSON is an error, never a panic. Filter and comparator types are often caller-supplied generics whose Serialize impl this crate cannot see.

§Errors

ClientError::Serialize when value’s Serialize impl fails, for example a map whose keys do not serialize as strings (JSON object keys are strings, RFC 8259 §4).