pub struct Any<T, O> { /* private fields */ }
Expand description
Any action type.
This allows you to use multiple types of actions at the same time as long as they all share the same target and output type.
Examples
let mut target = String::new();
let mut record = Record::new();
record.apply(&mut target, Any::new(Push('a')));
record.apply(&mut target, Any::new(FromFn::new(|s: &mut String| s.push('b'))));
assert_eq!(target, "ab");
Implementations§
Trait Implementations§
source§impl<T, O> Action for Any<T, O>
impl<T, O> Action for Any<T, O>
source§fn apply(&mut self, target: &mut Self::Target) -> Self::Output
fn apply(&mut self, target: &mut Self::Target) -> Self::Output
Applies the action on the target.
source§fn undo(&mut self, target: &mut Self::Target) -> Self::Output
fn undo(&mut self, target: &mut Self::Target) -> Self::Output
Restores the state of the target as it was before the action was applied.