solstack/trans.rs
1use crate::state::BoxState;
2
3/// A transition between [`State`](crate::state::State)s.
4///
5/// See the crates docs or the book for more information.
6/// ### Generics
7/// - D: Data available to all [`State`](crate::state::State)s to perform actions to.
8pub enum Trans<D> {
9 /// Pushes a new state above the current one.
10 /// Effectively pauses the current state until everything above it is
11 /// popped.
12 Push(BoxState<D>),
13
14 /// Pops the current state from the stack.
15 Pop,
16
17 /// Pops and pushes a new state.
18 /// Effectively replaces the current state with a new one.
19 Replace(BoxState<D>),
20
21 /// Pops every state from the stack and pushes a new one.
22 /// Effectively isolates it as the only state on the stack.
23 Isolate(BoxState<D>),
24
25 /// Pops everything from the stack.
26 /// Effectively ends the state stack machine.
27 Quit,
28
29 /// Does nothing to the stack.
30 /// Effectively keeps the current state and the stack the way it is.
31 None,
32}