pub struct MessageMutParIter<'a, E: Message> { /* private fields */ }
Expand description
A parallel iterator over Message
s.
Implementations§
Source§impl<'a, E: Message> MessageMutParIter<'a, E>
impl<'a, E: Message> MessageMutParIter<'a, E>
Sourcepub fn new(
mutator: &'a mut MessageCursor<E>,
messages: &'a mut Messages<E>,
) -> Self
pub fn new( mutator: &'a mut MessageCursor<E>, messages: &'a mut Messages<E>, ) -> Self
Creates a new parallel iterator over messages
that have not yet been seen by mutator
.
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 mut E) + Send + Sync + Clone>(self, func: FN)
pub fn for_each<FN: Fn(&'a mut E) + Send + Sync + Clone>(self, func: FN)
Runs the provided closure for each unread message in parallel.
Unlike normal iteration, the message order is not guaranteed in any form.
§Panics
If the ComputeTaskPool
is not initialized. If using this from a message reader that is being
initialized and run from the ECS scheduler, this should never panic.
Sourcepub fn for_each_with_id<FN: Fn(&'a mut E, MessageId<E>) + Send + Sync + Clone>(
self,
func: FN,
)
pub fn for_each_with_id<FN: Fn(&'a mut E, MessageId<E>) + Send + Sync + Clone>( self, func: FN, )
Runs the provided closure for each unread message in parallel, like for_each
,
but additionally provides the MessageId
to the closure.
Note that the order of iteration is not guaranteed, but MessageId
s are ordered by send order.
§Panics
If the ComputeTaskPool
is not initialized. If using this from a message reader that is being
initialized and run from the ECS scheduler, this should never panic.
Trait Implementations§
Source§impl<'a, E: Message> IntoIterator for MessageMutParIter<'a, E>
Available on crate feature multi_threaded
only.
impl<'a, E: Message> IntoIterator for MessageMutParIter<'a, E>
multi_threaded
only.Source§type IntoIter = MessageMutIteratorWithId<'a, E>
type IntoIter = MessageMutIteratorWithId<'a, E>
Source§type Item = <<MessageMutParIter<'a, E> as IntoIterator>::IntoIter as Iterator>::Item
type Item = <<MessageMutParIter<'a, E> as IntoIterator>::IntoIter as Iterator>::Item
Auto Trait Implementations§
impl<'a, E> Freeze for MessageMutParIter<'a, E>
impl<'a, E> RefUnwindSafe for MessageMutParIter<'a, E>where
E: RefUnwindSafe,
impl<'a, E> Send for MessageMutParIter<'a, E>
impl<'a, E> Sync for MessageMutParIter<'a, E>
impl<'a, E> Unpin for MessageMutParIter<'a, E>
impl<'a, E> !UnwindSafe for MessageMutParIter<'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>
, 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.