File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: iter:: FromIterator ;
2
2
3
- /// Collapses all unit items from an iterator into one .
3
+ /// Drains all items from an iterator.
4
4
///
5
- /// This is more useful when combined with higher-level abstractions, like
6
- /// collecting to a `Result<(), E>` where you only care about errors:
5
+ /// This is useful to run an iterator to completion when you don't
6
+ /// care about the result, or to collect into a `Result<(), E>` when
7
+ /// you only care about errors:
7
8
///
8
9
/// ```
9
10
/// use std::io::*;
@@ -14,8 +15,8 @@ use crate::iter::FromIterator;
14
15
/// assert!(res.is_ok());
15
16
/// ```
16
17
#[ stable( feature = "unit_from_iter" , since = "1.23.0" ) ]
17
- impl FromIterator < ( ) > for ( ) {
18
- fn from_iter < I : IntoIterator < Item = ( ) > > ( iter : I ) -> Self {
19
- iter. into_iter ( ) . for_each ( |( ) | { } )
18
+ impl < T > FromIterator < T > for ( ) {
19
+ fn from_iter < A : IntoIterator < Item = T > > ( iter : A ) -> Self {
20
+ iter. into_iter ( ) . for_each ( |_ | { } )
20
21
}
21
22
}
You can’t perform that action at this time.
0 commit comments