[][src]Trait automafish::ActionMut

pub trait ActionMut {
    type Input;
    pub fn execute_mut(&mut self, input: &mut Self::Input);
}

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.

Loading content...

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);
    }
}
Loading content...

Implementations on Foreign Types

impl<T> ActionMut for Box<dyn FnMut(&mut T)>[src]

type Input = T

impl<'a, T> ActionMut for &'a mut dyn FnMut(&mut T)[src]

type Input = T

Loading content...

Implementors

Loading content...