santa

Type Alias Transition

Source
pub(crate) type Transition = Transition<SimpleApp<Session>>;

Aliased Type§

enum Transition {
    Keep,
    KeepWithMouseover,
    Pop,
    ModifyState(Box<dyn FnOnce(&mut Box<dyn State<SimpleApp<Session>>>, &mut EventCtx<'_>, &mut SimpleApp<Session>)>),
    ConsumeState(Box<dyn FnOnce(Box<dyn State<SimpleApp<Session>>>, &mut EventCtx<'_>, &mut SimpleApp<Session>) -> Vec<Box<dyn State<SimpleApp<Session>>>>>),
    Push(Box<dyn State<SimpleApp<Session>>>),
    Replace(Box<dyn State<SimpleApp<Session>>>),
    Clear(Vec<Box<dyn State<SimpleApp<Session>>>>),
    Recreate,
    Multi(Vec<Transition<SimpleApp<Session>>>),
}

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<SimpleApp<Session>>>, &mut EventCtx<'_>, &mut SimpleApp<Session>)>)

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<SimpleApp<Session>>>, &mut EventCtx<'_>, &mut SimpleApp<Session>) -> Vec<Box<dyn State<SimpleApp<Session>>>>>)

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<SimpleApp<Session>>>)

Push a new active state on the top of the stack.

§

Replace(Box<dyn State<SimpleApp<Session>>>)

Replace the current state with a new one. Equivalent to Pop, then Push.

§

Clear(Vec<Box<dyn State<SimpleApp<Session>>>>)

Replace the entire stack of states with this stack.

§

Recreate

Call State::recreate on the current top of the stack

§

Multi(Vec<Transition<SimpleApp<Session>>>)

Execute a sequence of transitions in order.