use lib::*; pub fn from_bounds(iter: &I) -> Option where I: Iterator, { helper(iter.size_hint()) } #[cfg(any(feature = "std", feature = "alloc"))] #[inline] pub fn cautious(hint: Option) -> usize { cmp::min(hint.unwrap_or(0), 4096) } fn helper(bounds: (usize, Option)) -> Option { match bounds { (lower, Some(upper)) if lower == upper => Some(upper), _ => None, } }