From 3a87f915ecf579550fca181b7d2f484b06f28fdb Mon Sep 17 00:00:00 2001 From: Tei Roberts Date: Tue, 12 Sep 2023 23:49:56 +0200 Subject: [PATCH] fix: implement RandomFetch for entity ids --- src/filter/constant.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/filter/constant.rs b/src/filter/constant.rs index 84acb41..6281a2e 100644 --- a/src/filter/constant.rs +++ b/src/filter/constant.rs @@ -1,6 +1,6 @@ use crate::{ archetype::{Slice, Slot}, - fetch::{FetchAccessData, FetchPrepareData, PreparedFetch}, + fetch::{FetchAccessData, FetchPrepareData, PreparedFetch, RandomFetch}, system::Access, Entity, Fetch, FetchItem, }; @@ -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;