Skip to content

Commit 6e24b75

Browse files
author
blake2-ppc
committed
dlist: Rename rotate methods to .rotate_forward() and .rotate_backward()
1 parent 52b4a2e commit 6e24b75

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/libextra/dlist.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl<T> DList<T> {
261261
///
262262
/// If the list is empty, do nothing.
263263
#[inline]
264-
pub fn rotate_to_front(&mut self) {
264+
pub fn rotate_forward(&mut self) {
265265
do self.pop_back_node().map_consume |tail| {
266266
self.push_front_node(tail)
267267
};
@@ -271,7 +271,7 @@ impl<T> DList<T> {
271271
///
272272
/// If the list is empty, do nothing.
273273
#[inline]
274-
pub fn rotate_to_back(&mut self) {
274+
pub fn rotate_backward(&mut self) {
275275
do self.pop_front_node().map_consume |head| {
276276
self.push_back_node(head)
277277
};
@@ -715,23 +715,23 @@ mod tests {
715715
#[test]
716716
fn test_rotate() {
717717
let mut n = DList::new::<int>();
718-
n.rotate_to_back(); check_links(&n);
718+
n.rotate_backward(); check_links(&n);
719719
assert_eq!(n.len(), 0);
720-
n.rotate_to_front(); check_links(&n);
720+
n.rotate_forward(); check_links(&n);
721721
assert_eq!(n.len(), 0);
722722

723723
let v = ~[1,2,3,4,5];
724724
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);
727727
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);
730730
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);
733733
m.push_front(9); check_links(&m);
734-
m.rotate_to_front(); check_links(&m);
734+
m.rotate_forward(); check_links(&m);
735735
assert_eq!(~[3,9,5,1,2], m.consume_iter().collect());
736736
}
737737

@@ -1015,22 +1015,22 @@ mod tests {
10151015
}
10161016

10171017
#[bench]
1018-
fn bench_rotate_to_front(b: &mut test::BenchHarness) {
1018+
fn bench_rotate_forward(b: &mut test::BenchHarness) {
10191019
let mut m = DList::new::<int>();
10201020
m.push_front(0);
10211021
m.push_front(1);
10221022
do b.iter {
1023-
m.rotate_to_front();
1023+
m.rotate_forward();
10241024
}
10251025
}
10261026

10271027
#[bench]
1028-
fn bench_rotate_to_back(b: &mut test::BenchHarness) {
1028+
fn bench_rotate_backward(b: &mut test::BenchHarness) {
10291029
let mut m = DList::new::<int>();
10301030
m.push_front(0);
10311031
m.push_front(1);
10321032
do b.iter {
1033-
m.rotate_to_back();
1033+
m.rotate_backward();
10341034
}
10351035
}
10361036

0 commit comments

Comments
 (0)