@@ -261,7 +261,7 @@ impl<T> DList<T> {
261
261
///
262
262
/// If the list is empty, do nothing.
263
263
#[ inline]
264
- pub fn rotate_to_front ( & mut self ) {
264
+ pub fn rotate_forward ( & mut self ) {
265
265
do self . pop_back_node ( ) . map_consume |tail| {
266
266
self . push_front_node ( tail)
267
267
} ;
@@ -271,7 +271,7 @@ impl<T> DList<T> {
271
271
///
272
272
/// If the list is empty, do nothing.
273
273
#[ inline]
274
- pub fn rotate_to_back ( & mut self ) {
274
+ pub fn rotate_backward ( & mut self ) {
275
275
do self . pop_front_node ( ) . map_consume |head| {
276
276
self . push_back_node ( head)
277
277
} ;
@@ -715,23 +715,23 @@ mod tests {
715
715
#[ test]
716
716
fn test_rotate ( ) {
717
717
let mut n = DList : : new :: < int > ( ) ;
718
- n. rotate_to_back ( ) ; check_links( & n) ;
718
+ n. rotate_backward ( ) ; check_links( & n) ;
719
719
assert_eq ! ( n. len( ) , 0 ) ;
720
- n. rotate_to_front ( ) ; check_links( & n) ;
720
+ n. rotate_forward ( ) ; check_links( & n) ;
721
721
assert_eq ! ( n. len( ) , 0 ) ;
722
722
723
723
let v = ~[ 1 , 2 , 3 , 4 , 5 ] ;
724
724
let mut m = list_from( v) ;
725
- m. rotate_to_back ( ) ; check_links( & m) ;
726
- m. rotate_to_front ( ) ; check_links( & m) ;
725
+ m. rotate_backward ( ) ; check_links( & m) ;
726
+ m. rotate_forward ( ) ; check_links( & m) ;
727
727
assert_eq ! ( v. iter( ) . collect:: <~[ & int] >( ) , m. iter( ) . collect( ) ) ;
728
- m. rotate_to_front ( ) ; check_links( & m) ;
729
- m. rotate_to_front ( ) ; check_links( & m) ;
728
+ m. rotate_forward ( ) ; check_links( & m) ;
729
+ m. rotate_forward ( ) ; check_links( & m) ;
730
730
m. pop_front( ) ; check_links( & m) ;
731
- m. rotate_to_front ( ) ; check_links( & m) ;
732
- m. rotate_to_back ( ) ; check_links( & m) ;
731
+ m. rotate_forward ( ) ; check_links( & m) ;
732
+ m. rotate_backward ( ) ; check_links( & m) ;
733
733
m. push_front( 9 ) ; check_links( & m) ;
734
- m. rotate_to_front ( ) ; check_links( & m) ;
734
+ m. rotate_forward ( ) ; check_links( & m) ;
735
735
assert_eq ! ( ~[ 3 , 9 , 5 , 1 , 2 ] , m. consume_iter( ) . collect( ) ) ;
736
736
}
737
737
@@ -1015,22 +1015,22 @@ mod tests {
1015
1015
}
1016
1016
1017
1017
#[ bench]
1018
- fn bench_rotate_to_front ( b: & mut test:: BenchHarness ) {
1018
+ fn bench_rotate_forward ( b: & mut test:: BenchHarness ) {
1019
1019
let mut m = DList :: new:: <int>( ) ;
1020
1020
m. push_front( 0 ) ;
1021
1021
m. push_front( 1 ) ;
1022
1022
do b. iter {
1023
- m. rotate_to_front ( ) ;
1023
+ m. rotate_forward ( ) ;
1024
1024
}
1025
1025
}
1026
1026
1027
1027
#[ bench]
1028
- fn bench_rotate_to_back ( b: & mut test:: BenchHarness ) {
1028
+ fn bench_rotate_backward ( b: & mut test:: BenchHarness ) {
1029
1029
let mut m = DList :: new:: <int>( ) ;
1030
1030
m. push_front( 0 ) ;
1031
1031
m. push_front( 1 ) ;
1032
1032
do b. iter {
1033
- m. rotate_to_back ( ) ;
1033
+ m. rotate_backward ( ) ;
1034
1034
}
1035
1035
}
1036
1036
0 commit comments