SinglyList

Type Alias SinglyList 

Source
pub type SinglyList<T, P = SplitVec<Node<Singly<T>>, Recursive>> = List<Singly<T>, MemoryReclaimOnThreshold<2, Singly<T>, Singly<T>::Reclaimer>, P>;
Expand description

A singly linked list with default memory reclaim policy:

  • nodes hold a reference to the next element, but not to the previous;
  • memory of removed nodes are automatically reclaimed when utilization falls below 75%.

Importantly note that methods of the the following traits are also available:

Aliased Type§

pub struct SinglyList<T, P = SplitVec<Node<Singly<T>>, Recursive>>(/* private fields */);

Implementations§

Source§

impl<T> SinglyList<T>

Source

pub fn new() -> Self

Creates an empty singly linked list with default memory reclaim policy.

Source

pub fn with_threshold_reclaimer<const D: usize>() -> SinglyListThreshold<D, T>

Creates an empty singly linked list with custom memory reclaim on threshold policy:

  • memory of removed nodes are automatically reclaimed when the ratio of closed nodes to all nodes exceeds one over 2^D:
    • when D = 0: memory will be reclaimed when utilization is below 0.00% (equivalent to Lazy).
    • when D = 1: memory will be reclaimed when utilization is below 50.00%.
    • when D = 2: memory will be reclaimed when utilization is below 75.00%.
    • when D = 3: memory will be reclaimed when utilization is below 87.50%.
    • when D = 4: memory will be reclaimed when utilization is below 93.75%.

Trait Implementations§

Source§

impl<T> Default for SinglyList<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more