Trait utility_programming::Modifier
[−]
[src]
pub trait Modifier<T> { type Change; fn modify(&mut self, obj: &mut T) -> Self::Change; fn undo(&mut self, change: &Self::Change, obj: &mut T); fn redo(&mut self, change: &Self::Change, obj: &mut T); }
Modifies objects in a way that can be reversed.
Associated Types
type Change
The change applied to an object.
Required Methods
fn modify(&mut self, obj: &mut T) -> Self::Change
Modify an object and return the change.
This might be indeterministic.
fn undo(&mut self, change: &Self::Change, obj: &mut T)
Undo change made to an object.
Required to be deterministic.
fn redo(&mut self, change: &Self::Change, obj: &mut T)
Redo change made to an object.
Required to be deterministic.