Skip to main content

SetObject

Trait SetObject 

Source
pub trait SetObject: JmapObject {
    type Patch: Serialize + DeserializeOwned + Send + Sync + 'static;

    const SERVER_SET: &'static [&'static str];
    const CLIENT_SETTABLE: &'static [&'static str];
    const IMMUTABLE: &'static [&'static str];
}
Expand description

Marker for object types that support set (create/update/destroy) operations.

Required Associated Constants§

Source

const SERVER_SET: &'static [&'static str]

Wire names of the properties the spec marks “server-set”: “Only the server can set the value for this property. The client MUST NOT send this property when creating a new object of this type.” (RFC 8620 §1.1). A property the type’s /set method text never accepts from a client, on create or update, is server-set too.

A /set create that carries one, or an update patch that changes one, is invalidProperties (RFC 8620 §5.3).

Source

const CLIENT_SETTABLE: &'static [&'static str]

Wire names of every property that is not SERVER_SET: the ones a client may set through /set.

Each property of the type is in exactly one of SERVER_SET and CLIENT_SETTABLE; check_property_classification tests that.

Source

const IMMUTABLE: &'static [&'static str]

The CLIENT_SETTABLE properties the spec marks “immutable”: “The value MUST NOT change after the object is created.” (RFC 8620 §1.1). A property the /set method text accepts on create but not on update is immutable too.

A client may set one in a /set create; an update patch that changes one is invalidProperties.

Required Associated Types§

Source

type Patch: Serialize + DeserializeOwned + Send + Sync + 'static

The patch type for update operations.

Typically serde_json::Value holding an RFC 8620 §5.3 PatchObject, whose keys are JSON Pointer paths (RFC 6901) with an implicit leading /. This is not an RFC 7396 JSON Merge Patch. A typed struct is also allowed if it serializes to that PatchObject shape.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SetObject for PushSubscription

Property attributes from RFC 8620 §7.2 (rfc8620.txt:3593, 3597, 3618, 3623): id is “(immutable; server-set)”; deviceClientId, url and keys are “(immutable)”; verificationCode, expires and types carry no attribute.

Source§

const SERVER_SET: &'static [&'static str]

Source§

const CLIENT_SETTABLE: &'static [&'static str]

Source§

const IMMUTABLE: &'static [&'static str]

Source§

type Patch = PatchObject