pub struct UniqueView<'a, T: Unique> { /* private fields */ }
Expand description
Shared view over a unique component storage.
Implementations§
Source§impl<T: Unique> UniqueView<'_, T>
impl<T: Unique> UniqueView<'_, T>
Sourcepub fn clone(unique: &Self) -> Self
pub fn clone(unique: &Self) -> Self
Duplicates the UniqueView
.
Clone
is not implemented to not conflict with T::clone
.
Sourcepub fn override_last_insertion(
&mut self,
new_timestamp: TrackingTimestamp,
) -> TrackingTimestamp
pub fn override_last_insertion( &mut self, new_timestamp: TrackingTimestamp, ) -> TrackingTimestamp
Replaces the timestamp starting the tracking time window for insertions.
Tracking works based on a time window. From the last time the system ran (in workloads) or since the last clear.
Sometimes this automatic time window isn’t what you need. This can happen when you want to keep the same tracking information for multiple runs of the same system.
For example if you interpolate movement between frames, you might run an interpolation workload
multiple times but not change the World
during its execution.
In this case you want the same tracking information for all runs of this workload
which would have disappeared using the automatic window.
Sourcepub fn override_last_modification(
&mut self,
new_timestamp: TrackingTimestamp,
) -> TrackingTimestamp
pub fn override_last_modification( &mut self, new_timestamp: TrackingTimestamp, ) -> TrackingTimestamp
Replaces the timestamp starting the tracking time window for modifications.
Tracking works based on a time window. From the last time the system ran (in workloads) or since the last clear.
Sometimes this automatic time window isn’t what you need. This can happen when you want to keep the same tracking information for multiple runs of the same system.
For example if you interpolate movement between frames, you might run an interpolation workload
multiple times but not change the World
during its execution.
In this case you want the same tracking information for all runs of this workload
which would have disappeared using the automatic window.
Source§impl<T: Unique> UniqueView<'_, T>
impl<T: Unique> UniqueView<'_, T>
Sourcepub fn is_inserted(&self) -> bool
pub fn is_inserted(&self) -> bool
Returns true
if the component was inserted before the last clear_inserted
call.
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Returns true
is the component was modified since the last clear_modified
call.
Sourcepub fn is_inserted_or_modified(&self) -> bool
pub fn is_inserted_or_modified(&self) -> bool
Returns true
if the component was inserted or modified since the last clear_inserted
or clear_modified
call.
Trait Implementations§
Source§impl<T: Unique> AsRef<T> for UniqueView<'_, T>
impl<T: Unique> AsRef<T> for UniqueView<'_, T>
Source§impl<T: Send + Sync + Unique> Borrow for UniqueView<'_, T>
impl<T: Send + Sync + Unique> Borrow for UniqueView<'_, T>
type View<'a> = UniqueView<'a, T>
Source§fn borrow<'a>(
all_storages: &'a AllStorages,
all_borrow: Option<SharedBorrow<'a>>,
last_run: Option<TrackingTimestamp>,
current: TrackingTimestamp,
) -> Result<Self::View<'a>, GetStorage>
fn borrow<'a>( all_storages: &'a AllStorages, all_borrow: Option<SharedBorrow<'a>>, last_run: Option<TrackingTimestamp>, current: TrackingTimestamp, ) -> Result<Self::View<'a>, GetStorage>
Source§impl<'a, T: Send + Sync + Unique> BorrowInfo for UniqueView<'a, T>
impl<'a, T: Send + Sync + Unique> BorrowInfo for UniqueView<'a, T>
Source§fn borrow_info(info: &mut Vec<TypeInfo>)
fn borrow_info(info: &mut Vec<TypeInfo>)
Source§fn enable_tracking(_: &mut Vec<fn(&AllStorages) -> Result<(), GetStorage>>)
fn enable_tracking(_: &mut Vec<fn(&AllStorages) -> Result<(), GetStorage>>)
World
where this storage is borrowed.Auto Trait Implementations§
impl<'a, T> Freeze for UniqueView<'a, T>
impl<'a, T> RefUnwindSafe for UniqueView<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for UniqueView<'a, T>where
T: Sync,
impl<'a, T> Sync for UniqueView<'a, T>where
T: Sync,
impl<'a, T> Unpin for UniqueView<'a, T>
impl<'a, T> UnwindSafe for UniqueView<'a, T>where
T: RefUnwindSafe,
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
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>
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>
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