@@ -309,7 +309,7 @@ fn drain_to_empty_test() {
309309fn  test_cursor_move_peek ( )  { 
310310    let  mut  m:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
311311    m. extend ( & [ 1 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
312-     let  mut  cursor = m. cursor ( ) ; 
312+     let  mut  cursor = m. cursor_front ( ) ; 
313313    assert_eq ! ( cursor. current( ) ,  Some ( & 1 ) ) ; 
314314    assert_eq ! ( cursor. peek_next( ) ,  Some ( & 2 ) ) ; 
315315    assert_eq ! ( cursor. peek_prev( ) ,  None ) ; 
@@ -326,9 +326,26 @@ fn test_cursor_move_peek() {
326326    assert_eq ! ( cursor. peek_prev( ) ,  Some ( & 1 ) ) ; 
327327    assert_eq ! ( cursor. index( ) ,  Some ( 1 ) ) ; 
328328
329+     let  mut  cursor = m. cursor_back ( ) ; 
330+     assert_eq ! ( cursor. current( ) ,  Some ( & 6 ) ) ; 
331+     assert_eq ! ( cursor. peek_next( ) ,  None ) ; 
332+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & 5 ) ) ; 
333+     assert_eq ! ( cursor. index( ) ,  Some ( 5 ) ) ; 
334+     cursor. move_next ( ) ; 
335+     assert_eq ! ( cursor. current( ) ,  None ) ; 
336+     assert_eq ! ( cursor. peek_next( ) ,  Some ( & 1 ) ) ; 
337+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & 6 ) ) ; 
338+     assert_eq ! ( cursor. index( ) ,  None ) ; 
339+     cursor. move_prev ( ) ; 
340+     cursor. move_prev ( ) ; 
341+     assert_eq ! ( cursor. current( ) ,  Some ( & 5 ) ) ; 
342+     assert_eq ! ( cursor. peek_next( ) ,  Some ( & 6 ) ) ; 
343+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & 4 ) ) ; 
344+     assert_eq ! ( cursor. index( ) ,  Some ( 4 ) ) ; 
345+ 
329346    let  mut  m:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
330347    m. extend ( & [ 1 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
331-     let  mut  cursor = m. cursor_mut ( ) ; 
348+     let  mut  cursor = m. cursor_front_mut ( ) ; 
332349    assert_eq ! ( cursor. current( ) ,  Some ( & mut  1 ) ) ; 
333350    assert_eq ! ( cursor. peek_next( ) ,  Some ( & mut  2 ) ) ; 
334351    assert_eq ! ( cursor. peek_prev( ) ,  None ) ; 
@@ -352,24 +369,51 @@ fn test_cursor_move_peek() {
352369    assert_eq ! ( cursor2. index( ) ,  Some ( 2 ) ) ; 
353370    assert_eq ! ( cursor. current( ) ,  Some ( & mut  2 ) ) ; 
354371    assert_eq ! ( cursor. index( ) ,  Some ( 1 ) ) ; 
372+ 
373+     let  mut  m:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
374+     m. extend ( & [ 1 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
375+     let  mut  cursor = m. cursor_back_mut ( ) ; 
376+     assert_eq ! ( cursor. current( ) ,  Some ( & mut  6 ) ) ; 
377+     assert_eq ! ( cursor. peek_next( ) ,  None ) ; 
378+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & mut  5 ) ) ; 
379+     assert_eq ! ( cursor. index( ) ,  Some ( 5 ) ) ; 
380+     cursor. move_next ( ) ; 
381+     assert_eq ! ( cursor. current( ) ,  None ) ; 
382+     assert_eq ! ( cursor. peek_next( ) ,  Some ( & mut  1 ) ) ; 
383+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & mut  6 ) ) ; 
384+     assert_eq ! ( cursor. index( ) ,  None ) ; 
385+     cursor. move_prev ( ) ; 
386+     cursor. move_prev ( ) ; 
387+     assert_eq ! ( cursor. current( ) ,  Some ( & mut  5 ) ) ; 
388+     assert_eq ! ( cursor. peek_next( ) ,  Some ( & mut  6 ) ) ; 
389+     assert_eq ! ( cursor. peek_prev( ) ,  Some ( & mut  4 ) ) ; 
390+     assert_eq ! ( cursor. index( ) ,  Some ( 4 ) ) ; 
391+     let  mut  cursor2 = cursor. as_cursor ( ) ; 
392+     assert_eq ! ( cursor2. current( ) ,  Some ( & 5 ) ) ; 
393+     assert_eq ! ( cursor2. index( ) ,  Some ( 4 ) ) ; 
394+     cursor2. move_prev ( ) ; 
395+     assert_eq ! ( cursor2. current( ) ,  Some ( & 4 ) ) ; 
396+     assert_eq ! ( cursor2. index( ) ,  Some ( 3 ) ) ; 
397+     assert_eq ! ( cursor. current( ) ,  Some ( & mut  5 ) ) ; 
398+     assert_eq ! ( cursor. index( ) ,  Some ( 4 ) ) ; 
355399} 
356400
357401#[ test]  
358402fn  test_cursor_mut_insert ( )  { 
359403    let  mut  m:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
360404    m. extend ( & [ 1 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
361-     let  mut  cursor = m. cursor_mut ( ) ; 
405+     let  mut  cursor = m. cursor_front_mut ( ) ; 
362406    cursor. insert_before ( 7 ) ; 
363407    cursor. insert_after ( 8 ) ; 
364408    check_links ( & m) ; 
365409    assert_eq ! ( m. iter( ) . cloned( ) . collect:: <Vec <_>>( ) ,  & [ 7 ,  1 ,  8 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
366-     let  mut  cursor = m. cursor_mut ( ) ; 
410+     let  mut  cursor = m. cursor_front_mut ( ) ; 
367411    cursor. move_prev ( ) ; 
368412    cursor. insert_before ( 9 ) ; 
369413    cursor. insert_after ( 10 ) ; 
370414    check_links ( & m) ; 
371415    assert_eq ! ( m. iter( ) . cloned( ) . collect:: <Vec <_>>( ) ,  & [ 10 ,  7 ,  1 ,  8 ,  2 ,  3 ,  4 ,  5 ,  6 ,  9 ] ) ; 
372-     let  mut  cursor = m. cursor_mut ( ) ; 
416+     let  mut  cursor = m. cursor_front_mut ( ) ; 
373417    cursor. move_prev ( ) ; 
374418    assert_eq ! ( cursor. remove_current( ) ,  None ) ; 
375419    cursor. move_next ( ) ; 
@@ -383,7 +427,7 @@ fn test_cursor_mut_insert() {
383427    assert_eq ! ( cursor. remove_current( ) ,  Some ( 10 ) ) ; 
384428    check_links ( & m) ; 
385429    assert_eq ! ( m. iter( ) . cloned( ) . collect:: <Vec <_>>( ) ,  & [ 1 ,  8 ,  2 ,  3 ,  4 ,  5 ,  6 ] ) ; 
386-     let  mut  cursor = m. cursor_mut ( ) ; 
430+     let  mut  cursor = m. cursor_front_mut ( ) ; 
387431    let  mut  p:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
388432    p. extend ( & [ 100 ,  101 ,  102 ,  103 ] ) ; 
389433    let  mut  q:  LinkedList < u32 >  = LinkedList :: new ( ) ; 
@@ -395,12 +439,12 @@ fn test_cursor_mut_insert() {
395439        m. iter( ) . cloned( ) . collect:: <Vec <_>>( ) , 
396440        & [ 200 ,  201 ,  202 ,  203 ,  1 ,  100 ,  101 ,  102 ,  103 ,  8 ,  2 ,  3 ,  4 ,  5 ,  6 ] 
397441    ) ; 
398-     let  mut  cursor = m. cursor_mut ( ) ; 
442+     let  mut  cursor = m. cursor_front_mut ( ) ; 
399443    cursor. move_prev ( ) ; 
400444    let  tmp = cursor. split_before ( ) ; 
401445    assert_eq ! ( m. into_iter( ) . collect:: <Vec <_>>( ) ,  & [ ] ) ; 
402446    m = tmp; 
403-     let  mut  cursor = m. cursor_mut ( ) ; 
447+     let  mut  cursor = m. cursor_front_mut ( ) ; 
404448    cursor. move_next ( ) ; 
405449    cursor. move_next ( ) ; 
406450    cursor. move_next ( ) ; 
0 commit comments