Module generational_lru::list
source · [−]Expand description
Module providing a doubly linked list based deque implementation using a generational arena.
Usage:
use generational_lru::list::*;
let capacity = 10;
let mut list = LinkedList::<i32>::with_capacity(capacity);
for ele in 0..capacity {
assert!(list.push_back(ele as i32).is_ok());
}
let mut i = 0;
for ele in list.iter() {
assert_eq!(ele, &i);
i += 1;
}
let capacity = 10;
let mut list = LinkedList::<i32>::with_capacity(capacity);
assert_eq!(list.pop_front(), Err(ListError::ListEmpty));
for ele in 0..capacity {
assert!(list.push_back(ele as i32).is_ok());
}
for ele in 0..capacity {
assert_eq!(list.pop_front().unwrap(), ele as i32);
}
assert!(list.is_empty());
assert_eq!(list.pop_front(), Err(ListError::ListEmpty));
Structs
Iterator for our LinkedList.
Analogous to a pointer to a Node for our generational arena list. A link uniquely refers to a node in our linked list.
A generational arena based doubly linked list implementation.
A Node in our linked list. It uses Option<Link>
to point to other nodes.