LinkedList
on Vec
. Add and remove O(1) amortized. It has a similar interface to LinkedList
and similar to Vec
.
```rust use tsil_cev::TsilCev;
let mut tc = TsilCev::from(vec![5, 6, 7, 8, 9, 10]); tc.push_front(4);
let mut cursor = tc.cursorfrontmut(); assert_eq!(cursor.current(), Some(&4));
cursor.movenext(); asserteq!(cursor.current(), Some(&5));
cursor.remove(); assert_eq!(cursor.current(), Some(&6));
cursor.remove().remove().movenextlength(2); assert_eq!(cursor.current(), Some(&10));
cursor.moveprev(); asserteq!(cursor.current(), Some(&9));
let _ = tc.drainfiltertsil(|x| *x % 2 == 0).collect::
LinkedList
(thank Criterion)
The allocator for the elements is Vec
and each
element has two indexes (next and previous element).
Also if the number of elements is less than capacity / 4
then it is reallocated to size capacity / 2
. The time
of addition and removal is amortized to O(1)
.
serde
When this optional dependency is enabled, TsilCev
implements the
serde::Serialize
and serde::Deserialize
traits.