fix todo; removing a private type.
Seems unblocked since rust 1.51
This commit is contained in:
@@ -114,11 +114,7 @@ impl<T> PubSub<T> {
|
|||||||
let cursor = &self.cursors[sub.id as usize];
|
let cursor = &self.cursors[sub.id as usize];
|
||||||
let next = cursor.next(self.deleted_messages);
|
let next = cursor.next(self.deleted_messages);
|
||||||
|
|
||||||
// TODO: use self.queue.range(next..) once it is stabilised.
|
self.messages.range(next..)
|
||||||
MessageRange {
|
|
||||||
queue: &self.messages,
|
|
||||||
next,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Makes the given subscribe acknowledge all the messages in the queue.
|
/// 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user