pub struct StateMapRef<'a, U>(/* private fields */);
Expand description
Read-only state map.
The U
parameter is tag type that represents the map’s context.
Implementations§
source§impl<U> StateMapRef<'static, U>
impl<U> StateMapRef<'static, U>
source§impl<'a, U> StateMapRef<'a, U>
impl<'a, U> StateMapRef<'a, U>
sourcepub fn contains<T: StateValue>(self, id: impl Into<StateId<T>>) -> bool
pub fn contains<T: StateValue>(self, id: impl Into<StateId<T>>) -> bool
Gets if the ID is set in this map.
sourcepub fn get<T: StateValue>(self, id: impl Into<StateId<T>>) -> Option<&'a T>
pub fn get<T: StateValue>(self, id: impl Into<StateId<T>>) -> Option<&'a T>
Reference the ID’s value set in this map.
sourcepub fn copy<T: StateValue + Copy>(self, id: impl Into<StateId<T>>) -> Option<T>
pub fn copy<T: StateValue + Copy>(self, id: impl Into<StateId<T>>) -> Option<T>
Copy the ID’s value set in this map.
sourcepub fn get_clone<T: StateValue + Clone>(
self,
id: impl Into<StateId<T>>,
) -> Option<T>
pub fn get_clone<T: StateValue + Clone>( self, id: impl Into<StateId<T>>, ) -> Option<T>
Clone the ID’s value set in this map.
sourcepub fn req<T: StateValue>(self, id: impl Into<StateId<T>>) -> &'a T
pub fn req<T: StateValue>(self, id: impl Into<StateId<T>>) -> &'a T
Reference the ID’s value set in this map or panics if the key is not set.
Trait Implementations§
source§impl<U> Clone for StateMapRef<'_, U>
impl<U> Clone for StateMapRef<'_, U>
source§impl<U> Debug for StateMapRef<'_, U>
impl<U> Debug for StateMapRef<'_, U>
impl<U> Copy for StateMapRef<'_, U>
Auto Trait Implementations§
impl<'a, U> Freeze for StateMapRef<'a, U>
impl<'a, U> !RefUnwindSafe for StateMapRef<'a, U>
impl<'a, U> Send for StateMapRef<'a, U>where
U: Send,
impl<'a, U> Sync for StateMapRef<'a, U>where
U: Sync,
impl<'a, U> Unpin for StateMapRef<'a, U>where
U: Unpin,
impl<'a, U> !UnwindSafe for StateMapRef<'a, U>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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