Skip to content

Commit 487cbaf

Browse files
committed
Add better size hints for notification iterators
1 parent 0e1fa26 commit 487cbaf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/notification.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ impl<'a> Iterator for Iter<'a> {
117117
_ => unreachable!(),
118118
}
119119
}
120+
121+
fn size_hint(&self) -> (usize, Option<usize>) {
122+
(self.conn.conn.borrow().notifications.len(), None)
123+
}
120124
}
121125

122126
/// An iterator over notifications which will block if none are pending.
@@ -190,4 +194,8 @@ impl<'a> Iterator for TimeoutIter<'a> {
190194
_ => unreachable!(),
191195
}
192196
}
197+
198+
fn size_hint(&self) -> (usize, Option<usize>) {
199+
(self.conn.conn.borrow().notifications.len(), None)
200+
}
193201
}

0 commit comments

Comments
 (0)