pub enum Entry<'a, T: ComponentValue> {
Vacant(VacantEntry<'a, T>),
Occupied(OccupiedEntry<'a, T>),
}Expand description
Entry like api for an entity’s component
Variants§
Implementations§
Source§impl<'a, T> Entry<'a, T>where
T: ComponentValue,
impl<'a, T> Entry<'a, T>where
T: ComponentValue,
Sourcepub fn and_modify(self, func: impl FnMut(&mut T)) -> Self
pub fn and_modify(self, func: impl FnMut(&mut T)) -> Self
Mutate the value in place
Sourcepub fn or_insert(self, value: T) -> RefMut<'a, T>
pub fn or_insert(self, value: T) -> RefMut<'a, T>
Returns the contained component or inserts a default.
Sourcepub fn or_default(self) -> RefMut<'a, T>where
T: Default,
pub fn or_default(self) -> RefMut<'a, T>where
T: Default,
Return the component in the entry or insert the default value.
Sourcepub fn or_insert_with(self, func: impl FnOnce() -> T) -> RefMut<'a, T>
pub fn or_insert_with(self, func: impl FnOnce() -> T) -> RefMut<'a, T>
Returns the contained component or inserts a default provided by the function.
Auto Trait Implementations§
impl<'a, T> Freeze for Entry<'a, T>
impl<'a, T> !RefUnwindSafe for Entry<'a, T>
impl<'a, T> Send for Entry<'a, T>
impl<'a, T> Sync for Entry<'a, T>
impl<'a, T> Unpin for Entry<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Entry<'a, T>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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