pub struct UpdateDataModel {
pub surface_id: String,
pub path: String,
pub value: Value,
}Expand description
Payload of an updateDataModel message.
Upsert semantics: an existing path is replaced, a missing path is created,
and a null value deletes the key.
Fields§
§surface_id: StringSurface whose data model is being updated.
path: StringJSON Pointer into the data model. Defaults to /, the whole model.
value: ValueThe new value. null deletes the key at path.
Implementations§
Source§impl UpdateDataModel
impl UpdateDataModel
Sourcepub fn apply(&self, model: &mut Value) -> Result<()>
pub fn apply(&self, model: &mut Value) -> Result<()>
Applies this update to a surface data model in place.
pathof/or""replaces the whole model (or clears it tonull).- Missing intermediate objects are created.
- A
nullvalue removes the key (or, in an array, sets the slot tonullso the array keeps its length, per spec).
§Errors
Returns Error::Pointer when the pointer is malformed, when it walks
through a scalar, or when an array index is not a number within bounds.
Trait Implementations§
Source§impl Clone for UpdateDataModel
impl Clone for UpdateDataModel
Source§fn clone(&self) -> UpdateDataModel
fn clone(&self) -> UpdateDataModel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UpdateDataModel
impl Debug for UpdateDataModel
Source§impl<'de> Deserialize<'de> for UpdateDataModel
impl<'de> Deserialize<'de> for UpdateDataModel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for UpdateDataModel
impl PartialEq for UpdateDataModel
Source§fn eq(&self, other: &UpdateDataModel) -> bool
fn eq(&self, other: &UpdateDataModel) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for UpdateDataModel
impl Serialize for UpdateDataModel
impl StructuralPartialEq for UpdateDataModel
Auto Trait Implementations§
impl Freeze for UpdateDataModel
impl RefUnwindSafe for UpdateDataModel
impl Send for UpdateDataModel
impl Sync for UpdateDataModel
impl Unpin for UpdateDataModel
impl UnsafeUnpin for UpdateDataModel
impl UnwindSafe for UpdateDataModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more