Trait oxygengine_core::ecs::Fetch
source · [−]pub unsafe trait Fetch<'a> {
type Item;
type State: Copy;
fn dangling() -> Self;
fn access(archetype: &Archetype) -> Option<Access>;
fn borrow(archetype: &Archetype, state: Self::State);
fn prepare(archetype: &Archetype) -> Option<Self::State>;
fn execute(archetype: &'a Archetype, state: Self::State) -> Self;
fn release(archetype: &Archetype, state: Self::State);
fn for_each_borrow(f: impl FnMut(TypeId, bool));
unsafe fn get(&self, n: usize) -> Self::Item;
}Expand description
Streaming iterators over contiguous homogeneous ranges of components
Required Associated Types
Required Methods
How this query will access archetype, if at all
Look up state for archetype if it should be traversed
Construct a Fetch for archetype based on the associated state
Release dynamic borrows acquired by borrow
sourcefn for_each_borrow(f: impl FnMut(TypeId, bool))
fn for_each_borrow(f: impl FnMut(TypeId, bool))
Invoke f for every component type that may be borrowed and whether the borrow is unique
Access the nth item in this archetype without bounds checking
Safety
- Must only be called after
borrow releasemust not be called while'ais still live- Bounds-checking must be performed externally
- Any resulting borrows must be legal (e.g. no &mut to something another iterator might access)