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 Patchwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<Node>: Freeze,
PhantomData<String>: Freeze,
PhantomData<TableColumn>: Freeze,
PhantomData<Vec<Value>>: Freeze,
PhantomData<ChartSeries>: Freeze,
PhantomData<Map<String, Value>>: Freeze,
*const ChartSource is !null: Freeze,
PhantomData<ChartSource>: Freeze,
PhantomData<Shape>: Freeze,
PhantomData<GridBlock>: Freeze,
*const LeafNode<u32, f32> is !null: Freeze,
PhantomData<Box<(u32, f32)>>: Freeze,
impl Move for Patch
impl RefUnwindSafe for Patch
impl Send for Patch
impl Sync for Patch
impl Unpin for Patch
impl UnsafeUnpin for Patchwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<Node>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<TableColumn>: UnsafeUnpin,
PhantomData<Vec<Value>>: UnsafeUnpin,
PhantomData<ChartSeries>: UnsafeUnpin,
PhantomData<Map<String, Value>>: UnsafeUnpin,
*const ChartSource is !null: UnsafeUnpin,
PhantomData<ChartSource>: UnsafeUnpin,
PhantomData<Shape>: UnsafeUnpin,
PhantomData<GridBlock>: UnsafeUnpin,
*const LeafNode<u32, f32> is !null: UnsafeUnpin,
PhantomData<Box<(u32, f32)>>: UnsafeUnpin,
impl UnwindSafe for Patchwhere
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BoxRaw<ChartSource>: UnwindSafe,
BTreeMap<u32, f32>: UnwindSafe,
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