[−][src]Trait automafish::ActionMut
Action that may be executed when entering a state and may mutate its inner state.
The ActionMut
is implemented for Box<FnMut(T)>
by default.
Associated Types
type Input
Input type for the action.
Required methods
pub fn execute_mut(&mut self, input: &mut Self::Input)
Perform the action in the input.
Note that the input
takes the input type as a reference to allow multiple actions to be
executed on it if necessary. This doesn't prevent mutating the input though, since the
Input
itself can be defined as &mut Foo
.
Examples
struct IncrementValue<'a> { buffer: &'a mut Vec<u32> } impl<'a> ActionMut for IncrementValue<'a> { type Input = u32; fn execute_mut(&mut self, input: &mut Self::Input) { self.buffer.push(*input); } }