modify

Crates.iomodify
lib.rsmodify
version0.1.3
sourcesrc
created_at2024-02-16 11:08:47.201756
updated_at2024-03-07 19:26:55.922189
descriptionA library to track changes of a value.
homepage
repositoryhttps://github.com/fightling/modify.git
max_upload_size
id1142340
size5,671
Patrick Hoffmann (fightling)

documentation

README

Modify

Status Crates.io Documentation Dependency status

Attach a modified flag to a value and whenever the value is accessed via get_mut() this flag will be set until saved() is called.

Technical implements Deref and DerefMut to access the value.

Example

use crate::modify::*;

// create new Modify with a 42 in it
let mut value = Modify::new(42);
assert_eq!(value.is_modified(), false);

// set the value to 43 and check modified flag
*value = 43;
assert_eq!(value.is_modified(), true);

// reset modified flag check modified flag again
value.saved();
assert_eq!(value.is_modified(), false);
Commit count: 0

cargo fmt