Skip to content

Commit 40fd4d6

Browse files
committed
Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton
2 parents f663286 + 0ca1cae commit 40fd4d6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/libcore/iter.rs

+7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ pub trait Iterator {
9898
///
9999
/// An upper bound of `None` means either there is no known upper bound, or
100100
/// the upper bound does not fit within a `usize`.
101+
///
102+
/// # Examples
103+
///
104+
/// ```
105+
/// let it = (0..10).filter(|x| x % 2 == 0).chain(15..20);
106+
/// assert_eq!((5, Some(15)), it.size_hint());
107+
/// ```
101108
#[inline]
102109
#[stable(feature = "rust1", since = "1.0.0")]
103110
fn size_hint(&self) -> (usize, Option<usize>) { (0, None) }

0 commit comments

Comments
 (0)