pub struct ContiguousComponentTicksMut<'w> { /* private fields */ }Expand description
Data type storing contiguously lying ticks, which may be accessed to mutate.
Retrievable via ContiguousMut::split and probably only useful if you want to use the following
methods:
Implementations§
Source§impl<'w> ContiguousComponentTicksMut<'w>
impl<'w> ContiguousComponentTicksMut<'w>
Sourcepub fn new(
added: &'w mut [Tick],
changed: &'w mut [Tick],
last_run: Tick,
this_run: Tick,
caller: MaybeLocation<&'w mut [&'static Location<'static>]>,
) -> Option<ContiguousComponentTicksMut<'w>>
pub fn new( added: &'w mut [Tick], changed: &'w mut [Tick], last_run: Tick, this_run: Tick, caller: MaybeLocation<&'w mut [&'static Location<'static>]>, ) -> Option<ContiguousComponentTicksMut<'w>>
Creates a new ContiguousComponentTicksMut using provided values or returns None if lengths of
added, changed and changed_by do not match
This is an advanced feature, ContiguousComponentTicksMuts are designed to be created by
engine-internal code and consumed by end-user code.
added-Ticks that store the tick when the wrapped value was created.changed-Ticks that store the last time the wrapped value was changed.last_run- ATick, occurring beforethis_run, which is used as a reference to determine whether the wrapped value is newly added or changed.this_run- ATickcorresponding to the current point in time – “now”.caller-Locations that store the location when the wrapper value was changed.
Sourcepub fn changed_by(&self) -> MaybeLocation<&[&'static Location<'static>]>
pub fn changed_by(&self) -> MaybeLocation<&[&'static Location<'static>]>
Returns changed by locations’ slice.
Sourcepub fn changed_mut(&mut self) -> &mut [Tick]
pub fn changed_mut(&mut self) -> &mut [Tick]
Returns mutable changed ticks’ slice.
Sourcepub fn changed_by_mut(
&mut self,
) -> MaybeLocation<&mut [&'static Location<'static>]>
pub fn changed_by_mut( &mut self, ) -> MaybeLocation<&mut [&'static Location<'static>]>
Returns mutable changed by locations’ slice.
Sourcepub fn is_changed_iter(&self) -> impl Iterator<Item = bool>
pub fn is_changed_iter(&self) -> impl Iterator<Item = bool>
Returns an iterator where the i-th item corresponds to whether the i-th component was
marked as changed. If the value equals true, then the component was changed.
§Example
fn some_system(mut query: Query<&mut A>) {
for a in query.contiguous_iter_mut().unwrap() {
let (a_values, a_ticks) = ContiguousMut::split(a);
for (value, is_changed) in a_values.iter_mut().zip(a_ticks.is_changed_iter()) {
if is_changed {
value.0 *= 10;
}
}
}
}Sourcepub fn is_added_iter(&self) -> impl Iterator<Item = bool>
pub fn is_added_iter(&self) -> impl Iterator<Item = bool>
Returns an iterator where the i-th item corresponds to whether the i-th component was
marked as added. If the value equals true, then the component was added.
§Example
fn some_system(mut query: Query<&mut A>) {
for a in query.contiguous_iter_mut().unwrap() {
let (a_values, a_ticks) = ContiguousMut::split(a);
for (value, is_added) in a_values.iter_mut().zip(a_ticks.is_added_iter()) {
if is_added {
value.0 = 10;
}
}
}
}Sourcepub fn mark_all_as_changed(&mut self)
pub fn mark_all_as_changed(&mut self)
Marks every tick as changed.
Sourcepub fn reborrow(&mut self) -> ContiguousComponentTicksMut<'_>
pub fn reborrow(&mut self) -> ContiguousComponentTicksMut<'_>
Returns a ContiguousComponentTicksMut with a smaller lifetime.
Trait Implementations§
Source§impl<'w> From<ContiguousComponentTicksMut<'w>> for ContiguousComponentTicksRef<'w>
impl<'w> From<ContiguousComponentTicksMut<'w>> for ContiguousComponentTicksRef<'w>
Source§fn from(
value: ContiguousComponentTicksMut<'w>,
) -> ContiguousComponentTicksRef<'w>
fn from( value: ContiguousComponentTicksMut<'w>, ) -> ContiguousComponentTicksRef<'w>
Auto Trait Implementations§
impl<'w> Freeze for ContiguousComponentTicksMut<'w>
impl<'w> RefUnwindSafe for ContiguousComponentTicksMut<'w>
impl<'w> Send for ContiguousComponentTicksMut<'w>
impl<'w> Sync for ContiguousComponentTicksMut<'w>
impl<'w> Unpin for ContiguousComponentTicksMut<'w>
impl<'w> UnsafeUnpin for ContiguousComponentTicksMut<'w>
impl<'w> !UnwindSafe for ContiguousComponentTicksMut<'w>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more