pub struct MessageParIter<'a, M: Message> { /* private fields */ }Expand description
A parallel iterator over Messages.
Implementations§
Source§impl<'a, M: Message> MessageParIter<'a, M>
impl<'a, M: Message> MessageParIter<'a, M>
Sourcepub fn new(reader: &'a mut MessageCursor<M>, messages: &'a Messages<M>) -> Self
pub fn new(reader: &'a mut MessageCursor<M>, messages: &'a Messages<M>) -> Self
Creates a new parallel iterator over messages 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 M) + Send + Sync + Clone>(self, func: FN)
pub fn for_each<FN: Fn(&'a M) + 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 M, MessageId<M>) + Send + Sync + Clone>(
self,
func: FN,
)
pub fn for_each_with_id<FN: Fn(&'a M, MessageId<M>) + 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 MessageIds 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, M: Message> IntoIterator for MessageParIter<'a, M>
Available on crate feature multi_threaded only.
impl<'a, M: Message> IntoIterator for MessageParIter<'a, M>
multi_threaded only.