From 7375a691e232bb59033980dc09c7179bc16e377f Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sun, 5 May 2024 16:41:38 +0630 Subject: Fix some typos. (#620) --- src/data/graph.rs | 2 +- src/data/pubsub.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/data') 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 Graph { // 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..d595e03 100644 --- a/src/data/pubsub.rs +++ b/src/data/pubsub.rs @@ -103,7 +103,7 @@ impl PubSub { 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, i: usize) -> Option<&T> { let cursor = &self.cursors[sub.id as usize]; self.messages.get(cursor.next(self.deleted_messages) + i) -- cgit From a1b36b06298e99e442154c593551344236c48380 Mon Sep 17 00:00:00 2001 From: Thierry Berger Date: Wed, 29 May 2024 09:01:59 +0200 Subject: fix todo; removing a private type. Seems unblocked since rust 1.51 --- src/data/pubsub.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/data') diff --git a/src/data/pubsub.rs b/src/data/pubsub.rs index d595e03..92789f2 100644 --- a/src/data/pubsub.rs +++ b/src/data/pubsub.rs @@ -114,11 +114,7 @@ impl PubSub { 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 PubSub { } } } - -struct MessageRange<'a, T> { - queue: &'a VecDeque, - 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 - } -} -- cgit