pub type Transition = Transition<App>;
Aliased Type§
enum Transition {
Keep,
KeepWithMouseover,
Pop,
ModifyState(Box<dyn FnOnce(&mut Box<dyn State<App>>, &mut EventCtx<'_>, &mut App)>),
ConsumeState(Box<dyn FnOnce(Box<dyn State<App>>, &mut EventCtx<'_>, &mut App) -> Vec<Box<dyn State<App>>>>),
Push(Box<dyn State<App>>),
Replace(Box<dyn State<App>>),
Clear(Vec<Box<dyn State<App>>>),
Recreate,
Multi(Vec<Transition<App>>),
}
Variants§
Keep
Don’t do anything, keep the current state as the active one
KeepWithMouseover
Keep the current state as the active one, but immediately call event
again with a mouse
moved event
Pop
Destroy the current state, and resume from the previous one
ModifyState(Box<dyn FnOnce(&mut Box<dyn State<App>>, &mut EventCtx<'_>, &mut App)>)
If a state needs to pass data back to its parent, use this. In the callback, you have to downcast the previous state to populate it with data.
ConsumeState(Box<dyn FnOnce(Box<dyn State<App>>, &mut EventCtx<'_>, &mut App) -> Vec<Box<dyn State<App>>>>)
This destroys the current state, running the callback on it, and pushes new states onto the stack. The callback can consume the current state, thus salvaging fields from it without cloning.
Push(Box<dyn State<App>>)
Push a new active state on the top of the stack.
Replace(Box<dyn State<App>>)
Replace the current state with a new one. Equivalent to Pop, then Push.
Clear(Vec<Box<dyn State<App>>>)
Replace the entire stack of states with this stack.
Recreate
Call State::recreate
on the current top of the stack
Multi(Vec<Transition<App>>)
Execute a sequence of transitions in order.