@@ -48,14 +48,14 @@ struct Node<T> {
48
48
49
49
/// Double-ended DList iterator
50
50
#[ deriving( Clone ) ]
51
- pub struct DListIterator < ' a , T > {
51
+ pub struct Items < ' a , T > {
52
52
priv head : & ' a Link < T > ,
53
53
priv tail : Rawlink < Node < T > > ,
54
54
priv nelem : uint ,
55
55
}
56
56
57
57
/// Double-ended mutable DList iterator
58
- pub struct MutDListIterator < ' a , T > {
58
+ pub struct MutItems < ' a , T > {
59
59
priv list : & ' a mut DList < T > ,
60
60
priv head : Rawlink < Node < T > > ,
61
61
priv tail : Rawlink < Node < T > > ,
@@ -64,7 +64,7 @@ pub struct MutDListIterator<'a, T> {
64
64
65
65
/// DList consuming iterator
66
66
#[ deriving( Clone ) ]
67
- pub struct MoveIterator < T > {
67
+ pub struct MoveItems < T > {
68
68
priv list : DList < T >
69
69
}
70
70
@@ -362,24 +362,24 @@ impl<T> DList<T> {
362
362
363
363
/// Provide a forward iterator
364
364
#[ inline]
365
- pub fn iter < ' a > ( & ' a self ) -> DListIterator < ' a , T > {
366
- DListIterator { nelem : self . len ( ) , head : & self . list_head , tail : self . list_tail }
365
+ pub fn iter < ' a > ( & ' a self ) -> Items < ' a , T > {
366
+ Items { nelem : self . len ( ) , head : & self . list_head , tail : self . list_tail }
367
367
}
368
368
369
369
/// Provide a reverse iterator
370
370
#[ inline]
371
- pub fn rev_iter < ' a > ( & ' a self ) -> Invert < DListIterator < ' a , T > > {
371
+ pub fn rev_iter < ' a > ( & ' a self ) -> Invert < Items < ' a , T > > {
372
372
self . iter ( ) . invert ( )
373
373
}
374
374
375
375
/// Provide a forward iterator with mutable references
376
376
#[ inline]
377
- pub fn mut_iter < ' a > ( & ' a mut self ) -> MutDListIterator < ' a , T > {
377
+ pub fn mut_iter < ' a > ( & ' a mut self ) -> MutItems < ' a , T > {
378
378
let head_raw = match self . list_head {
379
379
Some ( ref mut h) => Rawlink :: some ( * h) ,
380
380
None => Rawlink :: none ( ) ,
381
381
} ;
382
- MutDListIterator {
382
+ MutItems {
383
383
nelem : self . len ( ) ,
384
384
head : head_raw,
385
385
tail : self . list_tail ,
@@ -388,20 +388,20 @@ impl<T> DList<T> {
388
388
}
389
389
/// Provide a reverse iterator with mutable references
390
390
#[ inline]
391
- pub fn mut_rev_iter < ' a > ( & ' a mut self ) -> Invert < MutDListIterator < ' a , T > > {
391
+ pub fn mut_rev_iter < ' a > ( & ' a mut self ) -> Invert < MutItems < ' a , T > > {
392
392
self . mut_iter ( ) . invert ( )
393
393
}
394
394
395
395
396
396
/// Consume the list into an iterator yielding elements by value
397
397
#[ inline]
398
- pub fn move_iter ( self ) -> MoveIterator < T > {
399
- MoveIterator { list : self }
398
+ pub fn move_iter ( self ) -> MoveItems < T > {
399
+ MoveItems { list : self }
400
400
}
401
401
402
402
/// Consume the list into an iterator yielding elements by value, in reverse
403
403
#[ inline]
404
- pub fn move_rev_iter ( self ) -> Invert < MoveIterator < T > > {
404
+ pub fn move_rev_iter ( self ) -> Invert < MoveItems < T > > {
405
405
self . move_iter ( ) . invert ( )
406
406
}
407
407
}
@@ -439,7 +439,7 @@ impl<T> Drop for DList<T> {
439
439
}
440
440
441
441
442
- impl < ' a , A > Iterator < & ' a A > for DListIterator < ' a , A > {
442
+ impl < ' a , A > Iterator < & ' a A > for Items < ' a , A > {
443
443
#[ inline]
444
444
fn next ( & mut self ) -> Option < & ' a A > {
445
445
if self . nelem == 0 {
@@ -458,7 +458,7 @@ impl<'a, A> Iterator<&'a A> for DListIterator<'a, A> {
458
458
}
459
459
}
460
460
461
- impl < ' a , A > DoubleEndedIterator < & ' a A > for DListIterator < ' a , A > {
461
+ impl < ' a , A > DoubleEndedIterator < & ' a A > for Items < ' a , A > {
462
462
#[ inline]
463
463
fn next_back ( & mut self ) -> Option < & ' a A > {
464
464
if self . nelem == 0 {
@@ -473,9 +473,9 @@ impl<'a, A> DoubleEndedIterator<&'a A> for DListIterator<'a, A> {
473
473
}
474
474
}
475
475
476
- impl < ' a , A > ExactSize < & ' a A > for DListIterator < ' a , A > { }
476
+ impl < ' a , A > ExactSize < & ' a A > for Items < ' a , A > { }
477
477
478
- impl < ' a , A > Iterator < & ' a mut A > for MutDListIterator < ' a , A > {
478
+ impl < ' a , A > Iterator < & ' a mut A > for MutItems < ' a , A > {
479
479
#[ inline]
480
480
fn next ( & mut self ) -> Option < & ' a mut A > {
481
481
if self . nelem == 0 {
@@ -497,7 +497,7 @@ impl<'a, A> Iterator<&'a mut A> for MutDListIterator<'a, A> {
497
497
}
498
498
}
499
499
500
- impl < ' a , A > DoubleEndedIterator < & ' a mut A > for MutDListIterator < ' a , A > {
500
+ impl < ' a , A > DoubleEndedIterator < & ' a mut A > for MutItems < ' a , A > {
501
501
#[ inline]
502
502
fn next_back ( & mut self ) -> Option < & ' a mut A > {
503
503
if self . nelem == 0 {
@@ -511,7 +511,7 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for MutDListIterator<'a, A> {
511
511
}
512
512
}
513
513
514
- impl < ' a , A > ExactSize < & ' a mut A > for MutDListIterator < ' a , A > { }
514
+ impl < ' a , A > ExactSize < & ' a mut A > for MutItems < ' a , A > { }
515
515
516
516
/// Allow mutating the DList while iterating
517
517
pub trait ListInsertion < A > {
@@ -524,8 +524,8 @@ pub trait ListInsertion<A> {
524
524
fn peek_next < ' a > ( & ' a mut self ) -> Option < & ' a mut A > ;
525
525
}
526
526
527
- // private methods for MutDListIterator
528
- impl < ' a , A > MutDListIterator < ' a , A > {
527
+ // private methods for MutItems
528
+ impl < ' a , A > MutItems < ' a , A > {
529
529
fn insert_next_node ( & mut self , mut ins_node : ~Node < A > ) {
530
530
// Insert before `self.head` so that it is between the
531
531
// previously yielded element and self.head.
@@ -547,7 +547,7 @@ impl<'a, A> MutDListIterator<'a, A> {
547
547
}
548
548
}
549
549
550
- impl < ' a , A > ListInsertion < A > for MutDListIterator < ' a , A > {
550
+ impl < ' a , A > ListInsertion < A > for MutItems < ' a , A > {
551
551
#[ inline]
552
552
fn insert_next ( & mut self , elt : A ) {
553
553
self . insert_next_node ( ~Node :: new ( elt) )
@@ -562,7 +562,7 @@ impl<'a, A> ListInsertion<A> for MutDListIterator<'a, A> {
562
562
}
563
563
}
564
564
565
- impl < A > Iterator < A > for MoveIterator < A > {
565
+ impl < A > Iterator < A > for MoveItems < A > {
566
566
#[ inline]
567
567
fn next ( & mut self ) -> Option < A > { self . list . pop_front ( ) }
568
568
@@ -572,7 +572,7 @@ impl<A> Iterator<A> for MoveIterator<A> {
572
572
}
573
573
}
574
574
575
- impl < A > DoubleEndedIterator < A > for MoveIterator < A > {
575
+ impl < A > DoubleEndedIterator < A > for MoveItems < A > {
576
576
#[ inline]
577
577
fn next_back ( & mut self ) -> Option < A > { self . list . pop_back ( ) }
578
578
}
0 commit comments