10 releases

0.2.8 Apr 8, 2023
0.2.7 Apr 8, 2023
0.2.4 Oct 19, 2022
0.2.0 Sep 3, 2022
0.1.0 Aug 18, 2022

#453 in Data structures

Download history 49/week @ 2024-02-09 5/week @ 2024-02-16 6/week @ 2024-02-23 3/week @ 2024-03-01 3/week @ 2024-03-08 2/week @ 2024-03-15 52/week @ 2024-03-29 11/week @ 2024-04-05

63 downloads per month

Apache-2.0

18KB
365 lines

Mutable

Mutable is a crate to keep track of changes in structures
It is still very much WIP

Here is a small example:

use mutable::Mutable;
use mutable_derive::Mutable;

#[derive(Mutable)]
struct Simple {
    size: usize,
}

#[derive(Mutable)]
struct Complex {
    id: String,
    value: Simple,
}

fn main() {
    let mut c0 = Complex { id: "a".to_string(), value: Simple { size: 32 } };
    let c1 = Complex { id: "b".to_string(), value: Simple { size: 64 } };

    assert_eq!(c0.update(c1), vec![
        ComplexMutation::Id(("a".to_string(), "b".to_string())),
        ComplexMutation::Value(SimpleMutation::Size((32, 64)))
    ]);
}

Dependencies

~1.5MB
~38K SLoC