mutable_derive

Crates.iomutable_derive
lib.rsmutable_derive
version0.3.3
sourcesrc
created_at2022-08-18 15:25:11.38951
updated_at2023-04-08 13:19:44.487263
descriptionImplementation for derive for Mutable and Softeq
homepage
repositoryhttps://gitlab.com/Thechi2000/mutable
max_upload_size
id648192
size11,851
(Thechi2000)

documentation

README

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)))
    ]);
}
Commit count: 36

cargo fmt