Skip to content

Commit

Permalink
doc: add Iterator::size_hint example
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang committed Aug 26, 2015
1 parent 7472886 commit 0ca1cae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libcore/iter.rs
Expand Up @@ -98,6 +98,13 @@ pub trait Iterator {
///
/// An upper bound of `None` means either there is no known upper bound, or
/// the upper bound does not fit within a `usize`.
///
/// # Examples
///
/// ```
/// let it = (0..10).filter(|x| x % 2 == 0).chain(15..20);
/// assert_eq!((5, Some(15)), it.size_hint());
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
fn size_hint(&self) -> (usize, Option<usize>) { (0, None) }
Expand Down

0 comments on commit 0ca1cae

Please sign in to comment.