Add better size hints for notification iterators

This commit is contained in:
Steven Fackler 2015-12-28 17:13:45 -07:00
parent 0e1fa26b48
commit 487cbaf9c2

View File

@ -117,6 +117,10 @@ impl<'a> Iterator for Iter<'a> {
_ => unreachable!(),
}
}
fn size_hint(&self) -> (usize, Option<usize>) {
(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<usize>) {
(self.conn.conn.borrow().notifications.len(), None)
}
}