pub fn value_diff_rec(v1: &Value, v2: &Value, _t: &Option<Type>) -> ValueEdit<RcValueEdit> {
    use Value::*;
    use ValueEdit::{Put, Skip};

    match (v1, v2) {
        (Opt(x), Opt(y)) => {
            let d = value_diff(
                &**x,
                &**y,
                // to do
                &Option::None,
            );
            if value_edit_is_skip(&d) {
                Skip
            } else {
                ValueEdit::Opt(d)
            }
        }
        (Variant(f1), Variant(f2)) => {
            if f1.0.id == f2.0.id {
                let edit = value_diff(&f1.0.val, &f2.0.val, &Option::None);
                if value_edit_is_skip(&edit) {
                    Skip
                } else {
                    ValueEdit::Variant(edit)
                }
            } else {
                Put(v2.clone())
            }
        }
        (Record(fs1), Record(fs2)) => {
            let edits = record_diff(fs1, fs2, Option::None); // to do -- give field types
            if edits.is_empty() {
                Skip
            } else {
                ValueEdit::Record(edits)
            }
        }
        (Vec(x), Vec(y)) => {
            let edits = vec_diff_simple(x, y, &Option::None); // to do -- give type
            if edits.is_empty() {
                Skip
            } else {
                ValueEdit::Vec(edits)
            }
        }
        (Bool(b1), Bool(b2)) => {
            if b1 == b2 {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Null, Null) => Skip,
        (Text(x), Text(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Number(x), Number(y)) => {
            // to do -- double-check this case
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int(x), Int(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat(x), Nat(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat8(x), Nat8(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat16(x), Nat16(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat32(x), Nat32(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat64(x), Nat64(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int8(x), Int8(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int16(x), Int16(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int32(x), Int32(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int64(x), Int64(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        _ => Put(v2.clone()),
    }
}
/// Compare the values, with optional (common) type.
Compare the values, with optional (common) type.
Compare the values with optional ( common ) type .
pub fn value_diff_rec(v1: &Value, v2: &Value, _t: &Option<Type>) -> ValueEdit<RcValueEdit> {
    use Value::*;
    use ValueEdit::{Put, Skip};
    match (v1, v2) {
        (Opt(x), Opt(y)) => {
            let d = value_diff(
                &**x,
                &**y,
                // to do
                &Option::None,
            );
            if value_edit_is_skip(&d) {
                Skip
            } else {
                ValueEdit::Opt(d)
            }
        }
        (Variant(f1), Variant(f2)) => {
            if f1.0.id == f2.0.id {
                let edit = value_diff(&f1.0.val, &f2.0.val, &Option::None);
                if value_edit_is_skip(&edit) {
                    Skip
                } else {
                    ValueEdit::Variant(edit)
                }
            } else {
                Put(v2.clone())
            }
        }
        (Record(fs1), Record(fs2)) => {
            let edits = record_diff(fs1, fs2, Option::None); // to do -- give field types
            if edits.is_empty() {
                Skip
            } else {
                ValueEdit::Record(edits)
            }
        }
        (Vec(x), Vec(y)) => {
            let edits = vec_diff_simple(x, y, &Option::None); // to do -- give type
            if edits.is_empty() {
                Skip
            } else {
                ValueEdit::Vec(edits)
            }
        }
        (Bool(b1), Bool(b2)) => {
            if b1 == b2 {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Null, Null) => Skip,
        (Text(x), Text(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Number(x), Number(y)) => {
            // to do -- double-check this case
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int(x), Int(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat(x), Nat(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat8(x), Nat8(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat16(x), Nat16(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat32(x), Nat32(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Nat64(x), Nat64(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int8(x), Int8(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int16(x), Int16(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int32(x), Int32(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        (Int64(x), Int64(y)) => {
            if x == y {
                Skip
            } else {
                Put(v2.clone())
            }
        }
        _ => Put(v2.clone()),
    }
}
pub fn value_diff_rec ( v1 : & Value , v2 : & Value , _t : & Option < Type > ) -> ValueEdit < RcValueEdit > { use Value :: * ; use ValueEdit :: { Put , Skip } ; match ( v1 , v2 ) { ( Opt ( x ) , Opt ( y ) ) => { let d = value_diff ( & * * x , & * * y , // to do & Option :: None , ) ; if value_edit_is_skip ( & d ) { Skip } else { ValueEdit :: Opt ( d ) } } ( Variant ( f1 ) , Variant ( f2 ) ) => { if f1 . 0 . id == f2 . 0 . id { let edit = value_diff ( & f1 . 0 . val , & f2 . 0 . val , & Option :: None ) ; if value_edit_is_skip ( & edit ) { Skip } else { ValueEdit :: Variant ( edit ) } } else { Put ( v2 . clone ( ) ) } } ( Record ( fs1 ) , Record ( fs2 ) ) => { let edits = record_diff ( fs1 , fs2 , Option :: None ) ; // to do -- give field types if edits . is_empty ( ) { Skip } else { ValueEdit :: Record ( edits ) } } ( Vec ( x ) , Vec ( y ) ) => { let edits = vec_diff_simple ( x , y , & Option :: None ) ; // to do -- give type if edits . is_empty ( ) { Skip } else { ValueEdit :: Vec ( edits ) } } ( Bool ( b1 ) , Bool ( b2 ) ) => { if b1 == b2 { Skip } else { Put ( v2 . clone ( ) ) } } ( Null , Null ) => Skip , ( Text ( x ) , Text ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Number ( x ) , Number ( y ) ) => { // to do -- double-check this case if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Int ( x ) , Int ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Nat ( x ) , Nat ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Nat8 ( x ) , Nat8 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Nat16 ( x ) , Nat16 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Nat32 ( x ) , Nat32 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Nat64 ( x ) , Nat64 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Int8 ( x ) , Int8 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Int16 ( x ) , Int16 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Int32 ( x ) , Int32 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } ( Int64 ( x ) , Int64 ( y ) ) => { if x == y { Skip } else { Put ( v2 . clone ( ) ) } } _ => Put ( v2 . clone ( ) ) , } }
Compare the values, with optional (common) type.
Compare the values with optional ( common ) type .
v1
&Value
v2
&Value
_t
&Option<Type>
v1
&Value
v2
&Value
_t
&Option<Type>