pub enum Patch {
Put {
path: String,
value: Value,
},
Replace {
at: Target,
node: Node,
},
Set {
at: Target,
fields: Map<String, Value>,
},
Append {
at: Target,
nodes: Vec<Node>,
},
Remove {
at: Target,
},
Rows {
at: Target,
start: usize,
rows: Vec<Vec<Value>>,
len: Option<usize>,
},
}Expand description
One change to a tree. In JSON each is an object with one field naming the operation:
{"set": {"key": "count", "fields": {"text": "3 left"}}}.
Variants§
Put
Replace whatever is at a JSON pointer into the tree as JSON: a node
(/children/1), one field (/children/1/text), a table row or cell
(/children/0/rows/7/2). This is what diff makes.
Replace
Replace the node.
Set
Change some fields of the node ({"text": "3 left", "tone": "success"}).
Append
Add children to the end of a container.
Remove
Remove the node.
Rows
Write table rows start..start + rows.len() (growing the table as needed), then cut
or grow it to len rows if given.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Patch
impl<'de> Deserialize<'de> for Patch
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Decodes like a reply’s patch list; a patch that doesn’t decode is an error here.
impl StructuralPartialEq for Patch
Auto Trait Implementations§
impl Forget for Patch
impl Freeze for Patch
impl Move for Patch
impl RefUnwindSafe for Patch
impl Send for Patch
impl Sync for Patch
impl Unpin for Patch
impl UnsafeUnpin for Patch
impl UnwindSafe for Patch
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