Merge pull request #639 from dimforge/fix-todo-range

Fix trivial todo; removing a private type.
This commit is contained in:
Thierry Berger
2024-05-29 11:15:42 +02:00
committed by GitHub

View File

@@ -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
}
}