Crate orx_linked_list
source ·Expand description
An actually useful linked list :) documentation will follow.
Example
use orx_linked_list::prelude::*;
let mut list = LinkedList::with_exponential_growth(2, 1.5);
// build linked list: x <-> a <-> b <-> c
list.push_back('a');
list.push_back('b');
list.push_front('x');
list.push_back('c');
assert_eq!(Some('c'), list.pop_back());
assert_eq!(Some('b'), list.pop_back());
assert_eq!(Some('a'), list.pop_back());
assert_eq!(Some('x'), list.pop_back());
assert_eq!(None, list.pop_back());
assert_eq!(None, list.pop_front());Modules
- Common traits, enums and structs.
Structs
- Stategy which allows to define a custom growth rate with a function of priorly created fragments.
- Stategy which allows creates a fragment with double the capacity of the prior fragment every time the split vector needs to expand.
- Stategy which allows new fragments grow exponentially.
- A fixed vector,
FixedVec, is a vector with a strict predetermined capacity (seeSplitVecfor dynamic capacity version). - A contagious fragment of the split vector.
ImpVecstands for ‘immutable-push-vec’.- Iterator over the
ImpVec. - Iterator over the
ImpVec. - Stategy which allows the split vector to grow linearly.
- The LinkedList allows pushing and popping elements at either end in constant time.
- Utilization of the underlying vector of the linked list.
- A split vector; i.e., a vector of fragments, with the following features:
- Iterator over the
SplitVec.
Enums
LinkedListholds all elements close to each other in aPinnedVecaiming for better cache locality while using thin references rather than wide pointers and to reduce heap allocations.- Returns the result of trying to get a slice as a contagious memory from the split vector.
Traits
- Marker trait for types to be contained in a
PinnedVecwhich do not hold a field which is a reference to a another element of the same vector. - A vector of elements of T which differs from the
std::vec::Vecby the following feature: PinnedVecSimpleis aPinnedVecwhere the elements satisfy the trait bound `T: NotSelfRefVecItem.- A type to be contained in a
PinnedVecwhich does hold a field which is a reference to a another element of the same vector. - Growth strategy of a split vector.