pub struct States { /* private fields */ }Implementations§
Source§impl States
impl States
pub fn insert<S: 'static>(&mut self, res: S)
pub fn remove<S>() -> Option<S>
Sourcepub fn get<S: 'static>(&self) -> Ref<'_, S>
pub fn get<S: 'static>(&self) -> Ref<'_, S>
Get an immutable borrow of a state of a given type S from global state store. Will panic if a borrow exists or the type specified does not exist in the state store
Sourcepub fn try_get<S: 'static>(&self) -> Result<Ref<'_, S>, StateError>
pub fn try_get<S: 'static>(&self) -> Result<Ref<'_, S>, StateError>
Attempts to get an immutable borrow of a state of a given type S from global state store
Sourcepub fn get_mut<S: 'static>(&self) -> RefMut<'_, S>
pub fn get_mut<S: 'static>(&self) -> RefMut<'_, S>
Get a mutable borrow of a state of a given type S from global state store. Will panic if a borrow exists or the type specified does not exist in the state store
Sourcepub fn try_get_mut<S: 'static>(&self) -> Result<RefMut<'_, S>, StateError>
pub fn try_get_mut<S: 'static>(&self) -> Result<RefMut<'_, S>, StateError>
Attempts to get a mutable borrow of a state of a given type S from global state store
Trait Implementations§
Auto Trait Implementations§
impl Freeze for States
impl !RefUnwindSafe for States
impl !Send for States
impl !Sync for States
impl Unpin for States
impl !UnwindSafe for States
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more