pub enum NodeOp {
Replace {
path: NodePath,
node: Node,
},
Set {
path: NodePath,
props: Map<String, Value>,
},
Splice {
path: NodePath,
field: PatchField,
index: u32,
remove: u32,
insert: Vec<PatchItem>,
},
Append {
path: NodePath,
field: PatchField,
items: Vec<PatchItem>,
},
Item {
path: NodePath,
field: PatchField,
key: String,
value: PatchItem,
},
}Expand description
One patch op (§4.7).
Variants§
Replace
Replace the node at path (empty path = the entry root).
Set
Shallow prop merge at path; null unsets a prop. Not for collections.
Splice
Remove remove items at index and insert insert (§4.7).
Fields
§
field: PatchFieldCollection to modify.
Append
Append items to a ring-trimmed collection (Log.lines, List.items,
Table.rows); older items drop silently past the limit (§4.8).
Fields
§
field: PatchFieldCollection to extend.
Item
Replace one keyed item (key sequence unchanged, §4.7).
Implementations§
Source§impl NodeOp
impl NodeOp
Sourcepub fn replace(
path: impl IntoIterator<Item = impl Into<String>>,
node: impl Into<Node>,
) -> Self
pub fn replace( path: impl IntoIterator<Item = impl Into<String>>, node: impl Into<Node>, ) -> Self
replace at path (an empty path is the entry root).
Sourcepub fn set(
path: impl IntoIterator<Item = impl Into<String>>,
props: Map<String, Json>,
) -> Self
pub fn set( path: impl IntoIterator<Item = impl Into<String>>, props: Map<String, Json>, ) -> Self
set: shallow prop merge at path.
Sourcepub fn splice(
path: impl IntoIterator<Item = impl Into<String>>,
field: PatchField,
index: u32,
remove: u32,
insert: impl IntoIterator<Item = impl Into<PatchItem>>,
) -> Self
pub fn splice( path: impl IntoIterator<Item = impl Into<String>>, field: PatchField, index: u32, remove: u32, insert: impl IntoIterator<Item = impl Into<PatchItem>>, ) -> Self
splice: remove remove members at index and insert insert.
Sourcepub fn append(
path: impl IntoIterator<Item = impl Into<String>>,
field: PatchField,
items: impl IntoIterator<Item = impl Into<PatchItem>>,
) -> Self
pub fn append( path: impl IntoIterator<Item = impl Into<String>>, field: PatchField, items: impl IntoIterator<Item = impl Into<PatchItem>>, ) -> Self
append: extend a ring-trimmed collection at path (the hot path for logs).
Sourcepub fn item(
path: impl IntoIterator<Item = impl Into<String>>,
field: PatchField,
key: impl Into<String>,
value: impl Into<PatchItem>,
) -> Self
pub fn item( path: impl IntoIterator<Item = impl Into<String>>, field: PatchField, key: impl Into<String>, value: impl Into<PatchItem>, ) -> Self
item: replace one keyed member at path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NodeOp
impl<'de> Deserialize<'de> for NodeOp
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
impl StructuralPartialEq for NodeOp
Auto Trait Implementations§
impl Freeze for NodeOp
impl RefUnwindSafe for NodeOp
impl Send for NodeOp
impl Sync for NodeOp
impl Unpin for NodeOp
impl UnsafeUnpin for NodeOp
impl UnwindSafe for NodeOp
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