[][src]Struct orbtk_api::widget_base::StatesContext

pub struct StatesContext<'a> { /* fields omitted */ }

The StatesContext provides access to the widget states.

Implementations

impl<'a> StatesContext<'a>[src]

pub fn new(
    states: &'a mut BTreeMap<Entity, Box<dyn State>>,
    ecm: &'a mut EntityComponentManager<Tree, StringComponentStore>
) -> Self
[src]

Creates a new state context.

pub fn get<S: Component>(&self, entity: Entity) -> &S[src]

Gets the state of the given widget.

Panics

Panics if the there is no state for the given entity or the given state type is wrong.

pub fn get_mut<S: Component>(&mut self, entity: Entity) -> &mut S[src]

Gets a mutable state of the given widget.

Panics

Panics if the there is no state for the given entity or the given state type is wrong.

pub fn try_get<S: Component>(&self, entity: Entity) -> Option<&S>[src]

Try to get the state of the given widget.

pub fn try_get_mut<S: Component>(&mut self, entity: Entity) -> Option<&mut S>[src]

Try to get a mutable reference of the state of the given widget.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for StatesContext<'a>

impl<'a> !Send for StatesContext<'a>

impl<'a> !Sync for StatesContext<'a>

impl<'a> Unpin for StatesContext<'a>

impl<'a> !UnwindSafe for StatesContext<'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<E> Component for E where
    E: Any
[src]

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

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

impl<T> SetParameter for T

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.