From 487cbaf9c2be7cd172ad7f03ddab12618d5f05db Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 28 Dec 2015 17:13:45 -0700 Subject: [PATCH] Add better size hints for notification iterators --- src/notification.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/notification.rs b/src/notification.rs index f825acb8..5ea405dd 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -117,6 +117,10 @@ impl<'a> Iterator for Iter<'a> { _ => unreachable!(), } } + + fn size_hint(&self) -> (usize, Option) { + (self.conn.conn.borrow().notifications.len(), None) + } } /// An iterator over notifications which will block if none are pending. @@ -190,4 +194,8 @@ impl<'a> Iterator for TimeoutIter<'a> { _ => unreachable!(), } } + + fn size_hint(&self) -> (usize, Option) { + (self.conn.conn.borrow().notifications.len(), None) + } }