Skip to content

Commit

Permalink
Add Index type alias in root
Browse files Browse the repository at this point in the history
For backwards compatibility with `0.2.7`
  • Loading branch information
Fairglow committed Nov 7, 2023
1 parent 2c0b260 commit 0d4246f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::{listnode::ListNode, listends::ListEnds};
pub use crate::listindex::ListIndex as ListIndex;
pub use crate::listiter::ListIter as ListIter;
pub use crate::listdrainiter::ListDrainIter as ListDrainIter;
pub type Index = ListIndex; // for backwards compatibility with 0.2.7

/// Doubly-linked list implemented in safe Rust.
#[derive(Debug)]
Expand Down Expand Up @@ -1031,4 +1032,11 @@ mod tests {
assert_eq!(size_of::<ListEnds>(), 8);
assert_eq!(size_of::<IndexList<u32>>(), 72);
}
#[test]
fn test_index_alias() {
let list = IndexList::from(&mut vec![1, 2, 3]);
let ndx: Index = list.first_index();
assert_eq!(ndx.get(), Some(0));
assert_eq!(list.get(ndx), Some(&1));
}
}

0 comments on commit 0d4246f

Please sign in to comment.