diff options
| author | bors <bors@rust-lang.org> | 2015-08-27 10:29:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-27 10:29:26 +0000 |
| commit | 40fd4d678706af0684cee1e95304352a6ca02837 (patch) | |
| tree | 1c207804c3f5a9d6661955372758e1f18d63f0a3 | |
| parent | f663286f2694748e111460c21e8b1cccab6516ca (diff) | |
| parent | 0ca1caee93a29f2581b4696e71cb45cb79e32033 (diff) | |
| download | rust-40fd4d678706af0684cee1e95304352a6ca02837.tar.gz rust-40fd4d678706af0684cee1e95304352a6ca02837.zip | |
Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichton
| -rw-r--r-- | src/libcore/iter.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index fcc6e72b9bb..3d17b10ba3a 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -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) } |
