We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Iterator::count()
1 parent 2477e24 commit 7550b61Copy full SHA for 7550b61
src/libcore/iter/traits/iterator.rs
@@ -202,8 +202,9 @@ pub trait Iterator {
202
/// Consumes the iterator, counting the number of iterations and returning it.
203
///
204
/// This method will evaluate the iterator until its [`next`] returns
205
- /// [`None`]. Once [`None`] is encountered, `count()` returns the number of
206
- /// times it called [`next`].
+ /// [`None`]. Once [`None`] is encountered, `count()` returns one less than the
+ /// number of times it called [`next`]. Note that [`next`] has to be called at
207
+ /// least once even if the iterator does not have any elements.
208
209
/// [`next`]: #tymethod.next
210
/// [`None`]: ../../std/option/enum.Option.html#variant.None
0 commit comments