Trait fluffl::collections::linked_list::LLOps
source · [−]pub trait LLOps<NodeType, DataType>where
NodeType: LLNodeOps<DataType> + LLNodeCoreOps,{
Show 16 methods
fn get_memory(&mut self) -> &Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
;
fn get_pool(&self) -> Ptr;
fn get_rear(&self) -> Ptr;
fn get_front(&self) -> Ptr;
fn len(&self) -> usize;
fn get_memory_mut(&mut self) -> &mut Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
;
fn get_pool_mut(&mut self) -> &mut Ptr;
fn insert(&mut self, cur_node: Ptr, dir: usize, data: DataType);
fn remove(&mut self, cur_node: Ptr) -> Option<DataType>;
fn allocate(&mut self, data: DataType) -> Ptr;
fn is_empty(&self) -> bool { ... }
fn push_front(&mut self, data: DataType) { ... }
fn pop_front(&mut self) -> Option<DataType> { ... }
fn push_rear(&mut self, data: DataType) { ... }
fn pop_rear(&mut self) -> Option<DataType> { ... }
fn free(&mut self, node: Ptr) { ... }
}
Expand description
Defines some higher order operations for a linked list
Required Methods
sourcefn get_memory(&mut self) -> &Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn get_memory(&mut self) -> &Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
In this implementation ‘memory’ is just a vector. This module implements what is referred to as a
‘vector-backed’ linked list.
sourcefn get_memory_mut(&mut self) -> &mut Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
fn get_memory_mut(&mut self) -> &mut Vec<NodeType>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
returns a mutable reference to memory
sourcefn get_pool_mut(&mut self) -> &mut Ptr
fn get_pool_mut(&mut self) -> &mut Ptr
returns a mutable reference to the pool pointer for external manipulation
sourcefn insert(&mut self, cur_node: Ptr, dir: usize, data: DataType)
fn insert(&mut self, cur_node: Ptr, dir: usize, data: DataType)
inserts a node to the left or right of location cur_node
in “memmory”
dir
= 0 when inserting to the left of cur_node
dir
= 1 when inserting to the right of cur_node