Struct bevy_ecs::event::EventParIter
source · pub struct EventParIter<'a, E: Event> { /* private fields */ }
Expand description
A parallel iterator over Event
s.
Implementations§
source§impl<'a, E: Event> EventParIter<'a, E>
impl<'a, E: Event> EventParIter<'a, E>
sourcepub fn new(reader: &'a mut ManualEventReader<E>, events: &'a Events<E>) -> Self
pub fn new(reader: &'a mut ManualEventReader<E>, events: &'a Events<E>) -> Self
Creates a new parallel iterator over events
that have not yet been seen by reader
.
sourcepub fn batching_strategy(self, strategy: BatchingStrategy) -> Self
pub fn batching_strategy(self, strategy: BatchingStrategy) -> Self
Changes the batching strategy used when iterating.
For more information on how this affects the resultant iteration, see
BatchingStrategy
.
sourcepub fn for_each<FN: Fn(&'a E) + Send + Sync + Clone>(self, func: FN)
pub fn for_each<FN: Fn(&'a E) + Send + Sync + Clone>(self, func: FN)
Runs the provided closure for each unread event in parallel.
Unlike normal iteration, the event order is not guaranteed in any form.
§Panics
If the ComputeTaskPool
is not initialized. If using this from an event reader that is being
initialized and run from the ECS scheduler, this should never panic.
sourcepub fn for_each_with_id<FN: Fn(&'a E, EventId<E>) + Send + Sync + Clone>(
self,
func: FN
)
pub fn for_each_with_id<FN: Fn(&'a E, EventId<E>) + Send + Sync + Clone>( self, func: FN )
Runs the provided closure for each unread event in parallel, like for_each
,
but additionally provides the EventId
to the closure.
Note that the order of iteration is not guaranteed, but EventId
s are ordered by send order.
§Panics
If the ComputeTaskPool
is not initialized. If using this from an event reader that is being
initialized and run from the ECS scheduler, this should never panic.
Trait Implementations§
source§impl<'a, E: Event> IntoIterator for EventParIter<'a, E>
impl<'a, E: Event> IntoIterator for EventParIter<'a, E>
§type IntoIter = EventIteratorWithId<'a, E>
type IntoIter = EventIteratorWithId<'a, E>
§type Item = <<EventParIter<'a, E> as IntoIterator>::IntoIter as Iterator>::Item
type Item = <<EventParIter<'a, E> as IntoIterator>::IntoIter as Iterator>::Item
Auto Trait Implementations§
impl<'a, E> Freeze for EventParIter<'a, E>
impl<'a, E> RefUnwindSafe for EventParIter<'a, E>where
E: RefUnwindSafe,
impl<'a, E> Send for EventParIter<'a, E>
impl<'a, E> Sync for EventParIter<'a, E>
impl<'a, E> Unpin for EventParIter<'a, E>
impl<'a, E> !UnwindSafe for EventParIter<'a, E>
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>
. Box<dyn Any>
can
then be further downcast
into Box<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>
. Rc<Any>
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.