@@ -58,8 +58,8 @@ use crate::iter::{FusedIterator, TrustedLen};
58
58
/// ```
59
59
#[ inline]
60
60
#[ stable( feature = "iter_once_with" , since = "1.43.0" ) ]
61
- pub fn once_with < A , F : FnOnce ( ) -> A > ( gen : F ) -> OnceWith < F > {
62
- OnceWith { gen : Some ( gen ) }
61
+ pub fn once_with < A , F : FnOnce ( ) -> A > ( make : F ) -> OnceWith < F > {
62
+ OnceWith { make : Some ( make ) }
63
63
}
64
64
65
65
/// An iterator that yields a single element of type `A` by
@@ -70,13 +70,13 @@ pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
70
70
#[ derive( Clone ) ]
71
71
#[ stable( feature = "iter_once_with" , since = "1.43.0" ) ]
72
72
pub struct OnceWith < F > {
73
- gen : Option < F > ,
73
+ make : Option < F > ,
74
74
}
75
75
76
76
#[ stable( feature = "iter_once_with_debug" , since = "1.68.0" ) ]
77
77
impl < F > fmt:: Debug for OnceWith < F > {
78
78
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
79
- if self . gen . is_some ( ) {
79
+ if self . make . is_some ( ) {
80
80
f. write_str ( "OnceWith(Some(_))" )
81
81
} else {
82
82
f. write_str ( "OnceWith(None)" )
@@ -90,13 +90,13 @@ impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
90
90
91
91
#[ inline]
92
92
fn next ( & mut self ) -> Option < A > {
93
- let f = self . gen . take ( ) ?;
93
+ let f = self . make . take ( ) ?;
94
94
Some ( f ( ) )
95
95
}
96
96
97
97
#[ inline]
98
98
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
99
- self . gen . iter ( ) . size_hint ( )
99
+ self . make . iter ( ) . size_hint ( )
100
100
}
101
101
}
102
102
@@ -110,7 +110,7 @@ impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> {
110
110
#[ stable( feature = "iter_once_with" , since = "1.43.0" ) ]
111
111
impl < A , F : FnOnce ( ) -> A > ExactSizeIterator for OnceWith < F > {
112
112
fn len ( & self ) -> usize {
113
- self . gen . iter ( ) . len ( )
113
+ self . make . iter ( ) . len ( )
114
114
}
115
115
}
116
116
0 commit comments