Reversible<T>
A generic wrapper struct that provides reversible editing capabilities for values of type T: Default + Debug + Clone.
Features
- Tracks changes separately from the original data
- Only clones the original data when modifications begin (lazy cloning)
- Optional Serde support for serialization/deserialization (with
serdefeature) - Implements
AsRef<T>andAsMut<T>for transparent access to the original and changed data.
Example
let mut rev = from;
assert_eq!;
*rev.as_mut = 13;
assert_eq!;
assert_eq!;
rev.save;
assert_eq!;
*rev.as_mut = 4;
assert_eq!;
assert_eq!;
rev.revert;
assert_eq!;