[][src]Struct seed_hooks::StateAccess

pub struct StateAccess<T> {
    pub id: Id,
    // some fields omitted
}

Accessor struct that provides access to getting and setting the state of the stored type

Fields

id: Id

Methods

impl<T> StateAccess<T> where
    T: 'static, 
[src]

pub fn new(id: Id) -> StateAccess<T>[src]

pub fn set(self, value: T)[src]

pub fn remove(self) -> Option<T>[src]

pub fn delete(self)[src]

pub fn reset_on_drop(self) -> StateAccess<T>[src]

pub fn update<F>(self, func: F) where
    F: FnOnce(&mut T), 
[src]

updates the stored state in place using the provided function

pub fn state_exists(self) -> bool[src]

pub fn get_with<F, R>(self, func: F) -> R where
    F: FnOnce(&T) -> R, 
[src]

Trait Implementations

impl<T> Add<StateAccess<T>> for StateAccess<T> where
    T: Copy + Add<T, Output = T> + 'static, 
[src]

type Output = T

The resulting type after applying the + operator.

impl<T> ChangedState for StateAccess<T> where
    T: Clone + 'static + PartialEq<T>, 
[src]

impl<T> Clone for StateAccess<T>[src]

impl<T> CloneState<T> for StateAccess<T> where
    T: Clone + 'static, 
[src]

fn get(&self) -> T[src]

returns a clone of the stored state panics if not stored.

impl<T> Copy for StateAccess<T>[src]

impl<T> Debug for StateAccess<T>[src]

impl<T> Display for StateAccess<T> where
    T: Display + 'static, 
[src]

impl StateAccessDropType for StateAccess<DropType>[src]

impl<T> StateAccessEventHandlers<T> for StateAccess<T> where
    T: 'static, 
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for StateAccess<T> where
    T: RefUnwindSafe

impl<T> Send for StateAccess<T> where
    T: Send

impl<T> Sync for StateAccess<T> where
    T: Sync

impl<T> Unpin for StateAccess<T> where
    T: Unpin

impl<T> UnwindSafe for StateAccess<T> where
    T: UnwindSafe

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

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

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> Erased for T

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

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

impl<T> Slottable for T where
    T: Copy
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.