Struct generational_cache::collections::list::LinkedList
source · pub struct LinkedList<V, T> { /* private fields */ }
Expand description
A double-linked linked list implementation using a generational Arena
for allocation.
Implementations§
source§impl<V, T> LinkedList<V, T>where
V: Vector<Entry<Node<T>>>,
impl<V, T> LinkedList<V, T>where V: Vector<Entry<Node<T>>>,
sourcepub fn with_backing_vector(vector: V) -> Self
pub fn with_backing_vector(vector: V) -> Self
Creates a new LinkedList
with given the backing Vector
for the underlying Arena
.
sourcepub fn clear(&mut self) -> Result<(), ListError<V::Error>>
pub fn clear(&mut self) -> Result<(), ListError<V::Error>>
Removes all elements from this LinkedList
.
sourcepub fn reserve(&mut self, additional: usize) -> Result<(), ListError<V::Error>>
pub fn reserve(&mut self, additional: usize) -> Result<(), ListError<V::Error>>
Reserves memory for the give number of additional elements in this LinkedList
.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements this LinkedList
is capable of storing.
Since this LinkedList
uses an Arena
for allocation, it’s capacity is subject to the
capacity of the underlying Arena
.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements stored in this LinkedList
.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns whether this LinkedList
is empty.
sourcepub fn push_front(&mut self, value: T) -> Result<Link, ListError<V::Error>>
pub fn push_front(&mut self, value: T) -> Result<Link, ListError<V::Error>>
Pushes the given element to the front of this LinkedList
.
sourcepub fn push_back(&mut self, value: T) -> Result<Link, ListError<V::Error>>
pub fn push_back(&mut self, value: T) -> Result<Link, ListError<V::Error>>
Pushes the given element to the back of this LinkedList
.
sourcepub fn peek_front(&self) -> Option<&T>
pub fn peek_front(&self) -> Option<&T>
Peeks the element at the front of this list.
sourcepub fn remove(&mut self, link: &Link) -> Option<T>
pub fn remove(&mut self, link: &Link) -> Option<T>
Removes the element referenced by the given link.
sourcepub fn shift_push_front(&mut self, link: &Link) -> Option<()>
pub fn shift_push_front(&mut self, link: &Link) -> Option<()>
Shifts the element at the given Link
to the front of this list.