Iter Who? IterList!
It's a doubly linked list with a cursor based api.
also an iterator!
O(1) pretty much everything (at and around the cursor).
Originally made it for Shard, but thought it could be useful to someone else.
Now Featuring: the atomic module!
Are you bored of performant data structures?
Do you want to do some lock-free shenanigans?
slaps hood
Well this baby's now Send + Sync and can mutate atomically across threads!
Using Result<Option<Result<Result ...

Example
use IterList;
let mut list = new;
list.push_prev;
list.push_next;
list.push_next;
list.push_next;
assert_eq!;
list.move_to;
assert_eq!;
list.move_by;
assert_eq!;
let mut cursor = list.as_cursor;
assert_eq!;
assert_eq!;
assert_eq!;
list.move_by;
let = list.consume_forward.unwrap;
assert_eq!;
assert_eq!;
let num = list.fold;
assert_eq!;
Why would I want to use IterList?
- You're iterating over a list, and are removing/inserting elements as you go.
(In my tests it was marginally better than
std::collections::VecDeque) - You want to have multiple independent cursors on the same list.
- You need an iterator that you can move around in and modify.
- It's also a noticably faster than
std::collections::LinkedListin most cases!
Todos
-
append- append another list to the end of this one. -
prepend- prepend another list to the start of this one. -
drain- remove a range of elements (around the cursor) from the list. -
splice- replace a range of elements (around the cursor) with another list. -
DoubleEndedIteratorforCursor. -
feature(atomic)- atomic IterList and Cursor. -
feature(pool)- semi-pool allocated list for grouping elements into contiguous memory. -
feature(no_std)- no std support.
Feel free to add any of these if ya wanna!