Skip to content

Commit

Permalink
Rename BatchedIter to ParIter
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantMoyer committed Sep 5, 2020
1 parent 5b1c784 commit 3d6d7f0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ impl<'w, Q: HecsQuery> QueryBorrow<'w, Q> {
///
/// Useful for distributing work over a threadpool using the
/// ParallelIterator interface.
pub fn iter_batched<'q>(&'q mut self, batch_size: u32) -> BatchedIter<'q, 'w, Q> {
BatchedIter {
pub fn par_iter<'q>(&'q mut self, batch_size: u32) -> ParIter<'q, 'w, Q> {
ParIter {
borrow: self,
archetype_index: 0,
batch_size,
Expand Down Expand Up @@ -274,17 +274,17 @@ impl<Q: HecsQuery> ChunkIter<Q> {
}

/// Batched version of `QueryIter`
pub struct BatchedIter<'q, 'w, Q: HecsQuery> {
pub struct ParIter<'q, 'w, Q: HecsQuery> {
borrow: &'q mut QueryBorrow<'w, Q>,
archetype_index: u32,
batch_size: u32,
batch: u32,
}

unsafe impl<'q, 'w, Q: HecsQuery> Send for BatchedIter<'q, 'w, Q> {}
unsafe impl<'q, 'w, Q: HecsQuery> Sync for BatchedIter<'q, 'w, Q> {}
unsafe impl<'q, 'w, Q: HecsQuery> Send for ParIter<'q, 'w, Q> {}
unsafe impl<'q, 'w, Q: HecsQuery> Sync for ParIter<'q, 'w, Q> {}

impl<'q, 'w, Q: HecsQuery> ParallelIterator<Batch<'q, Q>> for BatchedIter<'q, 'w, Q> {
impl<'q, 'w, Q: HecsQuery> ParallelIterator<Batch<'q, Q>> for ParIter<'q, 'w, Q> {
type Item = <Q::Fetch as Fetch<'q>>::Item;

fn next_batch(&mut self) -> Option<Batch<'q, Q>> {
Expand Down Expand Up @@ -317,7 +317,7 @@ impl<'q, 'w, Q: HecsQuery> ParallelIterator<Batch<'q, Q>> for BatchedIter<'q, 'w
}
}

/// A sequence of entities yielded by `BatchedIter`
/// A sequence of entities yielded by `ParIter`
pub struct Batch<'q, Q: HecsQuery> {
_marker: PhantomData<&'q ()>,
state: ChunkIter<Q>,
Expand Down

0 comments on commit 3d6d7f0

Please sign in to comment.