Skip to content

Commit

Permalink
Merge pull request #639 from dimforge/fix-todo-range
Browse files Browse the repository at this point in the history
Fix trivial todo; removing a private type.
  • Loading branch information
Vrixyz authored May 29, 2024
2 parents 798406e + a1b36b0 commit cfcbe58
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/data/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
}

0 comments on commit cfcbe58

Please sign in to comment.