File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -72,11 +72,6 @@ pub struct ConsumeIterator<T> {
72
72
priv list : DList < T >
73
73
}
74
74
75
- /// DList reverse consuming iterator
76
- pub struct ConsumeRevIterator < T > {
77
- priv list : DList < T >
78
- }
79
-
80
75
/// Rawlink is a type like Option<T> but for holding a raw pointer
81
76
impl < T > Rawlink < T > {
82
77
/// Like Option::None for Rawlink
@@ -346,8 +341,8 @@ impl<T> DList<T> {
346
341
}
347
342
348
343
/// Consume the list into an iterator yielding elements by value, in reverse
349
- pub fn consume_rev_iter ( self ) -> ConsumeRevIterator < T > {
350
- ConsumeRevIterator { list : self }
344
+ pub fn consume_rev_iter ( self ) -> InvertIterator < T , ConsumeIterator < T > > {
345
+ self . consume_iter ( ) . invert ( )
351
346
}
352
347
}
353
348
@@ -494,11 +489,8 @@ impl<A> Iterator<A> for ConsumeIterator<A> {
494
489
}
495
490
}
496
491
497
- impl < A > Iterator < A > for ConsumeRevIterator < A > {
498
- fn next ( & mut self ) -> Option < A > { self . list . pop_back ( ) }
499
- fn size_hint ( & self ) -> ( uint , Option < uint > ) {
500
- ( self . list . length , Some ( self . list . length ) )
501
- }
492
+ impl < A > DoubleEndedIterator < A > for ConsumeIterator < A > {
493
+ fn next_back ( & mut self ) -> Option < A > { self . list . pop_back ( ) }
502
494
}
503
495
504
496
impl < A , T : Iterator < A > > FromIterator < A , T > for DList < A > {
You can’t perform that action at this time.
0 commit comments