diff options
| author | Thierry Berger <contact@thierryberger.com> | 2024-06-03 15:20:24 +0200 |
|---|---|---|
| committer | Thierry Berger <contact@thierryberger.com> | 2024-06-03 15:20:24 +0200 |
| commit | e1ed90603e618e28f48916690d761e0d8213e2ad (patch) | |
| tree | 8399da9825ca9ee8edd601b1265e818fa303b541 /src/data | |
| parent | fe336b9b98d5825544ad3a153a84cb59dc9171c6 (diff) | |
| parent | 856675032e76b6eb4bc9e0be4dc87abdbcfe0421 (diff) | |
| download | rapier-e1ed90603e618e28f48916690d761e0d8213e2ad.tar.gz rapier-e1ed90603e618e28f48916690d761e0d8213e2ad.tar.bz2 rapier-e1ed90603e618e28f48916690d761e0d8213e2ad.zip | |
Merge branch 'master' into collider-builder-debug
Diffstat (limited to 'src/data')
| -rw-r--r-- | src/data/graph.rs | 2 | ||||
| -rw-r--r-- | src/data/pubsub.rs | 24 |
2 files changed, 3 insertions, 23 deletions
diff --git a/src/data/graph.rs b/src/data/graph.rs index 6a3ba15..6c701e4 100644 --- a/src/data/graph.rs +++ b/src/data/graph.rs @@ -370,7 +370,7 @@ impl<N, E> Graph<N, E> { // indices. let edge = self.edges.swap_remove(e.index()); let swap = match self.edges.get(e.index()) { - // no elment needed to be swapped. + // no element needed to be swapped. None => return Some(edge.weight), Some(ed) => ed.node, }; diff --git a/src/data/pubsub.rs b/src/data/pubsub.rs index 619521e..92789f2 100644 --- a/src/data/pubsub.rs +++ b/src/data/pubsub.rs @@ -103,7 +103,7 @@ impl<T> PubSub<T> { subscription } - /// Read the i-th message not yet read by the given subsciber. + /// Read the i-th message not yet read by the given subscriber. pub fn read_ith(&self, sub: &Subscription<T>, i: usize) -> Option<&T> { let cursor = &self.cursors[sub.id as usize]; self.messages.get(cursor.next(self.deleted_messages) + i) @@ -114,11 +114,7 @@ impl<T> PubSub<T> { let cursor = &self.cursors[sub.id as usize]; let next = cursor.next(self.deleted_messages); - // TODO: use self.queue.range(next..) once it is stabilised. - MessageRange { - queue: &self.messages, - next, - } + self.messages.range(next..) } /// Makes the given subscribe acknowledge all the messages in the queue. @@ -159,19 +155,3 @@ impl<T> PubSub<T> { } } } - -struct MessageRange<'a, T> { - queue: &'a VecDeque<T>, - next: usize, -} - -impl<'a, T> Iterator for MessageRange<'a, T> { - type Item = &'a T; - - #[inline(always)] - fn next(&mut self) -> Option<&'a T> { - let result = self.queue.get(self.next); - self.next += 1; - result - } -} |
