Skip to main content

QuerySpecMut

Trait QuerySpecMut 

Source
pub trait QuerySpecMut {
    type Item<'w>;
    type State<'w>;

    // Required methods
    fn matches(layout: &ArchetypeLayout) -> bool;
    fn init_state<'w>(
        archetype: &'w mut Archetype,
        tick: u64,
    ) -> Option<Self::State<'w>>;
    fn len(state: &Self::State<'_>) -> usize;
    fn entity(state: &Self::State<'_>, row: usize) -> Entity;
    unsafe fn fetch<'w>(
        state: &mut Self::State<'w>,
        row: usize,
    ) -> Self::Item<'w>;
}
Expand description

Describes a mutable query fetch over matching archetypes.

Required Associated Types§

Source

type Item<'w>

Source

type State<'w>

Required Methods§

Source

fn matches(layout: &ArchetypeLayout) -> bool

Source

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source

fn len(state: &Self::State<'_>) -> usize

Source

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

§Safety

Callers must only request each row at most once per live state. Doing otherwise could create aliased mutable references into the same archetype column data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<A: Component, B: Component, C: Component> QuerySpecMut for (&mut A, &mut B, &mut C)

Source§

type Item<'w> = (Mut<'w, A>, Mut<'w, B>, Mut<'w, C>)

Source§

type State<'w> = TripleMutState<'w, A, B, C>

Source§

fn matches(layout: &ArchetypeLayout) -> bool

Source§

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source§

fn len(state: &Self::State<'_>) -> usize

Source§

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source§

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

Source§

impl<A: Component, B: Component> QuerySpecMut for (&mut A, &mut B)

Source§

type Item<'w> = (Mut<'w, A>, Mut<'w, B>)

Source§

type State<'w> = PairMutState<'w, A, B>

Source§

fn matches(layout: &ArchetypeLayout) -> bool

Source§

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source§

fn len(state: &Self::State<'_>) -> usize

Source§

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source§

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

Source§

impl<A: Component, B: Component> QuerySpecMut for (&mut A, Option<&mut B>)

Source§

type Item<'w> = (Mut<'w, A>, Option<Mut<'w, B>>)

Source§

type State<'w> = PairMutOptionalState<'w, A, B>

Source§

fn matches(layout: &ArchetypeLayout) -> bool

Source§

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source§

fn len(state: &Self::State<'_>) -> usize

Source§

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source§

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

Source§

impl<T: Component> QuerySpecMut for &mut T

Source§

type Item<'w> = Mut<'w, T>

Source§

type State<'w> = SingleMutState<'w, T>

Source§

fn matches(layout: &ArchetypeLayout) -> bool

Source§

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source§

fn len(state: &Self::State<'_>) -> usize

Source§

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source§

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

Source§

impl<T: Component> QuerySpecMut for Option<&mut T>

Optional mutable query: matches all archetypes (never filters), returns Some(&mut T) when the column is present and None when absent.

Source§

type Item<'w> = Option<Mut<'w, T>>

Source§

type State<'w> = OptionalMutState<'w, T>

Source§

fn matches(_layout: &ArchetypeLayout) -> bool

Source§

fn init_state<'w>( archetype: &'w mut Archetype, tick: u64, ) -> Option<Self::State<'w>>

Source§

fn len(state: &Self::State<'_>) -> usize

Source§

fn entity(state: &Self::State<'_>, row: usize) -> Entity

Source§

unsafe fn fetch<'w>(state: &mut Self::State<'w>, row: usize) -> Self::Item<'w>

Implementors§