shipyard/track/
insertion.rs1use crate::component::Component;
2use crate::entity_id::EntityId;
3use crate::seal::Sealed;
4use crate::sparse_set::SparseSet;
5use crate::track::Insertion;
6use crate::tracking::{InsertionTracking, Tracking, TrackingTimestamp};
7
8impl Sealed for Insertion {}
9
10impl Tracking for Insertion {
11 const VALUE: u32 = 0b0001;
12
13 fn name() -> &'static str {
14 "Insertion"
15 }
16
17 #[inline]
18 fn is_inserted<T: Component>(
19 sparse_set: &SparseSet<T>,
20 entity: EntityId,
21 last: TrackingTimestamp,
22 current: TrackingTimestamp,
23 ) -> bool {
24 if let Some(dense) = sparse_set.index_of(entity) {
25 sparse_set.insertion_data[dense].is_within(last, current)
26 } else {
27 false
28 }
29 }
30}
31
32impl InsertionTracking for Insertion {}