dkernel_card/patch/
mod.rs

1mod string_diff;
2use hir::expr::Expr;
3
4use crate::{content::Content, flat_node::NodeRef};
5
6use self::string_diff::StringPatch;
7
8#[derive(Debug, Clone, PartialEq)]
9pub enum ContentPatch {
10    Overwrite(Content),
11    PatchString(Vec<StringPatch>),
12    AddInteger(u64),
13    AddFloat(f64),
14}
15
16// ContentPatch::AddFloat should not be NaN
17impl Eq for ContentPatch {}
18
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum ChildrenPatch {
21    Insert { index: usize, node: NodeRef },
22    Remove(usize),
23    Move { index: usize, diff: isize },
24}
25
26#[derive(Debug, Clone, PartialEq, Eq)]
27pub struct AttributePatch {
28    pub key: String,
29    pub value: Expr,
30}