@@ -51,21 +51,21 @@ struct Node<T> {
51
51
}
52
52
53
53
/// An iterator over references to the items of a `DList`.
54
- pub struct Items < ' a , T : ' a > {
54
+ pub struct Iter < ' a , T : ' a > {
55
55
head : & ' a Link < T > ,
56
56
tail : Rawlink < Node < T > > ,
57
57
nelem : uint ,
58
58
}
59
59
60
60
// FIXME #11820: the &'a Option<> of the Link stops clone working.
61
- impl < ' a , T > Clone for Items < ' a , T > {
62
- fn clone ( & self ) -> Items < ' a , T > { * self }
61
+ impl < ' a , T > Clone for Iter < ' a , T > {
62
+ fn clone ( & self ) -> Iter < ' a , T > { * self }
63
63
}
64
64
65
- impl < ' a , T > Copy for Items < ' a , T > { }
65
+ impl < ' a , T > Copy for Iter < ' a , T > { }
66
66
67
67
/// An iterator over mutable references to the items of a `DList`.
68
- pub struct MutItems < ' a , T : ' a > {
68
+ pub struct IterMut < ' a , T : ' a > {
69
69
list : & ' a mut DList < T > ,
70
70
head : Rawlink < Node < T > > ,
71
71
tail : Rawlink < Node < T > > ,
@@ -74,7 +74,7 @@ pub struct MutItems<'a, T:'a> {
74
74
75
75
/// An iterator over mutable references to the items of a `DList`.
76
76
#[ deriving( Clone ) ]
77
- pub struct MoveItems < T > {
77
+ pub struct IntoIter < T > {
78
78
list : DList < T >
79
79
}
80
80
@@ -394,19 +394,19 @@ impl<T> DList<T> {
394
394
/// Provides a forward iterator.
395
395
#[ inline]
396
396
#[ unstable = "matches collection reform specification, waiting for dust to settle" ]
397
- pub fn iter < ' a > ( & ' a self ) -> Items < ' a , T > {
398
- Items { nelem : self . len ( ) , head : & self . list_head , tail : self . list_tail }
397
+ pub fn iter < ' a > ( & ' a self ) -> Iter < ' a , T > {
398
+ Iter { nelem : self . len ( ) , head : & self . list_head , tail : self . list_tail }
399
399
}
400
400
401
401
/// Provides a forward iterator with mutable references.
402
402
#[ inline]
403
403
#[ unstable = "matches collection reform specification, waiting for dust to settle" ]
404
- pub fn iter_mut < ' a > ( & ' a mut self ) -> MutItems < ' a , T > {
404
+ pub fn iter_mut < ' a > ( & ' a mut self ) -> IterMut < ' a , T > {
405
405
let head_raw = match self . list_head {
406
406
Some ( ref mut h) => Rawlink :: some ( & mut * * h) ,
407
407
None => Rawlink :: none ( ) ,
408
408
} ;
409
- MutItems {
409
+ IterMut {
410
410
nelem : self . len ( ) ,
411
411
head : head_raw,
412
412
tail : self . list_tail ,
@@ -417,8 +417,8 @@ impl<T> DList<T> {
417
417
/// Consumes the list into an iterator yielding elements by value.
418
418
#[ inline]
419
419
#[ unstable = "matches collection reform specification, waiting for dust to settle" ]
420
- pub fn into_iter ( self ) -> MoveItems < T > {
421
- MoveItems { list : self }
420
+ pub fn into_iter ( self ) -> IntoIter < T > {
421
+ IntoIter { list : self }
422
422
}
423
423
424
424
/// Returns `true` if the `DList` is empty.
@@ -579,7 +579,7 @@ impl<T> Drop for DList<T> {
579
579
}
580
580
581
581
582
- impl < ' a , A > Iterator < & ' a A > for Items < ' a , A > {
582
+ impl < ' a , A > Iterator < & ' a A > for Iter < ' a , A > {
583
583
#[ inline]
584
584
fn next ( & mut self ) -> Option < & ' a A > {
585
585
if self . nelem == 0 {
@@ -598,7 +598,7 @@ impl<'a, A> Iterator<&'a A> for Items<'a, A> {
598
598
}
599
599
}
600
600
601
- impl < ' a , A > DoubleEndedIterator < & ' a A > for Items < ' a , A > {
601
+ impl < ' a , A > DoubleEndedIterator < & ' a A > for Iter < ' a , A > {
602
602
#[ inline]
603
603
fn next_back ( & mut self ) -> Option < & ' a A > {
604
604
if self . nelem == 0 {
@@ -612,9 +612,9 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Items<'a, A> {
612
612
}
613
613
}
614
614
615
- impl < ' a , A > ExactSizeIterator < & ' a A > for Items < ' a , A > { }
615
+ impl < ' a , A > ExactSizeIterator < & ' a A > for Iter < ' a , A > { }
616
616
617
- impl < ' a , A > Iterator < & ' a mut A > for MutItems < ' a , A > {
617
+ impl < ' a , A > Iterator < & ' a mut A > for IterMut < ' a , A > {
618
618
#[ inline]
619
619
fn next ( & mut self ) -> Option < & ' a mut A > {
620
620
if self . nelem == 0 {
@@ -636,7 +636,7 @@ impl<'a, A> Iterator<&'a mut A> for MutItems<'a, A> {
636
636
}
637
637
}
638
638
639
- impl < ' a , A > DoubleEndedIterator < & ' a mut A > for MutItems < ' a , A > {
639
+ impl < ' a , A > DoubleEndedIterator < & ' a mut A > for IterMut < ' a , A > {
640
640
#[ inline]
641
641
fn next_back ( & mut self ) -> Option < & ' a mut A > {
642
642
if self . nelem == 0 {
@@ -650,7 +650,7 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for MutItems<'a, A> {
650
650
}
651
651
}
652
652
653
- impl < ' a , A > ExactSizeIterator < & ' a mut A > for MutItems < ' a , A > { }
653
+ impl < ' a , A > ExactSizeIterator < & ' a mut A > for IterMut < ' a , A > { }
654
654
655
655
/// Allows mutating a `DList` while iterating.
656
656
pub trait ListInsertion < A > {
@@ -664,8 +664,8 @@ pub trait ListInsertion<A> {
664
664
fn peek_next < ' a > ( & ' a mut self ) -> Option < & ' a mut A > ;
665
665
}
666
666
667
- // private methods for MutItems
668
- impl < ' a , A > MutItems < ' a , A > {
667
+ // private methods for IterMut
668
+ impl < ' a , A > IterMut < ' a , A > {
669
669
fn insert_next_node ( & mut self , mut ins_node : Box < Node < A > > ) {
670
670
// Insert before `self.head` so that it is between the
671
671
// previously yielded element and self.head.
@@ -687,7 +687,7 @@ impl<'a, A> MutItems<'a, A> {
687
687
}
688
688
}
689
689
690
- impl < ' a , A > ListInsertion < A > for MutItems < ' a , A > {
690
+ impl < ' a , A > ListInsertion < A > for IterMut < ' a , A > {
691
691
#[ inline]
692
692
fn insert_next ( & mut self , elt : A ) {
693
693
self . insert_next_node ( box Node :: new ( elt) )
@@ -702,7 +702,7 @@ impl<'a, A> ListInsertion<A> for MutItems<'a, A> {
702
702
}
703
703
}
704
704
705
- impl < A > Iterator < A > for MoveItems < A > {
705
+ impl < A > Iterator < A > for IntoIter < A > {
706
706
#[ inline]
707
707
fn next ( & mut self ) -> Option < A > { self . list . pop_front ( ) }
708
708
@@ -712,7 +712,7 @@ impl<A> Iterator<A> for MoveItems<A> {
712
712
}
713
713
}
714
714
715
- impl < A > DoubleEndedIterator < A > for MoveItems < A > {
715
+ impl < A > DoubleEndedIterator < A > for IntoIter < A > {
716
716
#[ inline]
717
717
fn next_back ( & mut self ) -> Option < A > { self . list . pop_back ( ) }
718
718
}
0 commit comments