Skip to content

Commit

Permalink
fix: implement RandomFetch for entity ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Sep 12, 2023
1 parent 361b206 commit 3a87f91
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/filter/constant.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
archetype::{Slice, Slot},
fetch::{FetchAccessData, FetchPrepareData, PreparedFetch},
fetch::{FetchAccessData, FetchPrepareData, PreparedFetch, RandomFetch},
system::Access,
Entity, Fetch, FetchItem,
};
Expand Down Expand Up @@ -149,6 +149,16 @@ pub struct PreparedEntity {
id: Entity,
}

impl<'q> RandomFetch<'q> for PreparedEntity {
unsafe fn fetch_shared(&'q self, _: Slot) -> Self::Item {
self.id
}

unsafe fn fetch_shared_chunk(chunk: &Self::Chunk, _: Slot) -> Self::Item {
*chunk
}
}

impl<'w> PreparedFetch<'w> for PreparedEntity {
type Item = Entity;

Expand Down

0 comments on commit 3a87f91

Please sign in to comment.