Function bones_ecs::entities::OptionalMut
source ยท pub fn OptionalMut<'a, T: HasSchema, C, S>(
component_ref: &'a mut S,
) -> OptionalQueryItemMut<'a, T, S>where
C: ComponentIterBitset<'a, T> + 'a,
S: DerefMut<Target = C> + 'a,
Expand description
Helper func to construct a OptionalQueryItemMut
wrapping a CompMut
SystemParam
.
Used to iterate over enities optionally and mutably retrieving components from ComponentStore
.
Entities iterated over will not be filtered by this QueryItem
.
This example filters entities by compC
, optionally retrieves compA
as mutable, and
compB
as immutable.
entities.iter_with(&mut OptionalMut(&mut compA), &Optional(&compB), &compC)
This will implement QueryItem
as long as generic type implements std::ops::DerefMut
for
ComponentStore
, such as CompMut
.