• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use lib::*;
2 
from_bounds<I>(iter: &I) -> Option<usize> where I: Iterator,3 pub fn from_bounds<I>(iter: &I) -> Option<usize>
4 where
5     I: Iterator,
6 {
7     helper(iter.size_hint())
8 }
9 
10 #[cfg(any(feature = "std", feature = "alloc"))]
11 #[inline]
cautious(hint: Option<usize>) -> usize12 pub fn cautious(hint: Option<usize>) -> usize {
13     cmp::min(hint.unwrap_or(0), 4096)
14 }
15 
helper(bounds: (usize, Option<usize>)) -> Option<usize>16 fn helper(bounds: (usize, Option<usize>)) -> Option<usize> {
17     match bounds {
18         (lower, Some(upper)) if lower == upper => Some(upper),
19         _ => None,
20     }
21 }
22