[][src]Enum widgetry::Transition

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

When a state responds to an event, it can specify some way to manipulate the stack of states.

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

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.

ReplaceWithData(Box<dyn FnOnce(Box<dyn State<A>>, &mut EventCtx<'_>, &mut A) -> Vec<Box<dyn State<A>>>>)
Push(Box<dyn State<A>>)

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

Replace(Box<dyn State<A>>)

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

Clear(Vec<Box<dyn State<A>>>)

Replace the entire stack of states with this stack.

Multi(Vec<Transition<A>>)

Execute a sequence of transitions in order.

Auto Trait Implementations

impl<A> !RefUnwindSafe for Transition<A>

impl<A> !Send for Transition<A>

impl<A> !Sync for Transition<A>

impl<A> Unpin for Transition<A>

impl<A> !UnwindSafe for Transition<A>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.