File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,44 @@ impl<T> PeekingNext for ::alloc::vec::IntoIter<T> {
105105 }
106106}
107107
108+ #[ cfg( feature = "use_alloc" ) ]
109+ impl < ' a , T > PeekingNext for :: alloc:: vec:: Drain < ' a , T > {
110+ fn peeking_next < F > ( & mut self , accept : F ) -> Option < Self :: Item >
111+ where
112+ F : FnOnce ( & Self :: Item ) -> bool ,
113+ {
114+ match accept ( self . as_slice ( ) . first ( ) ?) {
115+ true => self . next ( ) ,
116+ false => None ,
117+ }
118+ }
119+ }
120+
121+ #[ cfg( feature = "use_alloc" ) ]
122+ impl < ' a > PeekingNext for :: alloc:: string:: Drain < ' a > {
123+ fn peeking_next < F > ( & mut self , accept : F ) -> Option < Self :: Item >
124+ where
125+ F : FnOnce ( & Self :: Item ) -> bool ,
126+ {
127+ match accept ( & self . as_str ( ) . chars ( ) . next ( ) ?) {
128+ true => self . next ( ) ,
129+ false => None ,
130+ }
131+ }
132+ }
133+
134+ impl < T , const N : usize > PeekingNext for :: core:: array:: IntoIter < T , N > {
135+ fn peeking_next < F > ( & mut self , accept : F ) -> Option < Self :: Item >
136+ where
137+ F : FnOnce ( & Self :: Item ) -> bool ,
138+ {
139+ match accept ( self . as_slice ( ) . first ( ) ?) {
140+ true => self . next ( ) ,
141+ false => None ,
142+ }
143+ }
144+ }
145+
108146impl < T : Clone > PeekingNext for RepeatN < T > {
109147 fn peeking_next < F > ( & mut self , accept : F ) -> Option < Self :: Item >
110148 where
You can’t perform that action at this time.
0 commit comments