[][src]Struct melib::backends::jmap::rfc8620::Set

pub struct Set<OBJ: Object> where
    OBJ: Debug + Serialize
{ pub account_id: Id<Account>, pub if_in_state: Option<State<OBJ>>, pub create: Option<HashMap<Id<OBJ>, OBJ>>, pub update: Option<HashMap<Id<OBJ>, Value>>, pub destroy: Option<Vec<Id<OBJ>>>, }

#set

Modifying the state of Foo objects on the server is done via the "Foo/set" method. This encompasses creating, updating, and destroying Foo records. This allows the server to sort out ordering and dependencies that may exist if doing multiple operations at once (for example, to ensure there is always a minimum number of a certain record type).

Fields

account_id: Id<Account>

o accountId: "Id"

The id of the account to use.

if_in_state: Option<State<OBJ>>

o ifInState: "String|null"

This is a state string as returned by the "Foo/get" method (representing the state of all objects of this type in the account). If supplied, the string must match the current state; otherwise, the method will be aborted and a "stateMismatch" error returned. If null, any changes will be applied to the current state.

create: Option<HashMap<Id<OBJ>, OBJ>>

o create: "Id[Foo]|null"

A map of a creation id (a temporary id set by the client) to Foo objects, or null if no objects are to be created.

The Foo object type definition may define default values for properties. Any such property may be omitted by the client.

The client MUST omit any properties that may only be set by the server (for example, the "id" property on most object types).

update: Option<HashMap<Id<OBJ>, Value>>

o update: "Id[PatchObject]|null"

A map of an id to a Patch object to apply to the current Foo object with that id, or null if no objects are to be updated.

A PatchObject is of type "String[*]" and represents an unordered set of patches. The keys are a path in JSON Pointer format [RFC6901], with an implicit leading "/" (i.e., prefix each key with "/" before applying the JSON Pointer evaluation algorithm).

All paths MUST also conform to the following restrictions; if there is any violation, the update MUST be rejected with an "invalidPatch" error:

The value associated with each pointer determines how to apply that patch:

Any server-set properties MAY be included in the patch if their value is identical to the current server value (before applying the patches to the object). Otherwise, the update MUST be rejected with an "invalidProperties" SetError.

This patch definition is designed such that an entire Foo object is also a valid PatchObject. The client may choose to optimise network usage by just sending the diff or may send the whole object; the server processes it the same either way.

destroy: Option<Vec<Id<OBJ>>>

o destroy: "Id[]|null"

A list of ids for Foo objects to permanently delete, or null if no objects are to be destroyed.

Implementations

impl<OBJ: Object> Set<OBJ> where
    OBJ: Debug + Serialize
[src]

pub fn new() -> Self[src]

pub fn account_id(self, new_val: Id<Account>) -> Self[src]

pub fn if_in_state(self, new_val: Option<State<OBJ>>) -> Self[src]

o ifInState: "String|null"

This is a state string as returned by the "Foo/get" method (representing the state of all objects of this type in the account). If supplied, the string must match the current state; otherwise, the method will be aborted and a "stateMismatch" error returned. If null, any changes will be applied to the current state.

pub fn update(self, new_val: Option<HashMap<Id<OBJ>, Value>>) -> Self[src]

Trait Implementations

impl<OBJ: Debug + Object> Debug for Set<OBJ> where
    OBJ: Debug + Serialize
[src]

impl<'de, OBJ: Object> Deserialize<'de> for Set<OBJ> where
    OBJ: Debug + Serialize,
    OBJ: Deserialize<'de>, 
[src]

impl<OBJ: Object> Serialize for Set<OBJ> where
    OBJ: Debug + Serialize,
    OBJ: Serialize
[src]

Auto Trait Implementations

impl<OBJ> RefUnwindSafe for Set<OBJ> where
    OBJ: RefUnwindSafe

impl<OBJ> Send for Set<OBJ> where
    OBJ: Send

impl<OBJ> Sync for Set<OBJ> where
    OBJ: Sync

impl<OBJ> Unpin for Set<OBJ> where
    OBJ: Unpin

impl<OBJ> UnwindSafe for Set<OBJ> where
    OBJ: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]