pub struct PooledLinkedList { /* private fields */ }Expand description
Pooled linked list - uses nodes from global pool
This maintains only the list structure (head/tail/len), while all nodes are allocated from the global pool.
Implementations§
Source§impl PooledLinkedList
impl PooledLinkedList
Sourcepub fn insert_sorted(
&mut self,
pool: &mut GlobalNodePool,
data: BuddyBlock,
) -> bool
pub fn insert_sorted( &mut self, pool: &mut GlobalNodePool, data: BuddyBlock, ) -> bool
Insert element in sorted order (ascending by address) This is used for buddy free lists to enable efficient contiguity checking
Sourcepub fn has_block_in_range(
&self,
pool: &GlobalNodePool,
start: usize,
end: usize,
) -> bool
pub fn has_block_in_range( &self, pool: &GlobalNodePool, start: usize, end: usize, ) -> bool
Check if any block in the list falls within the given address range [start, end)
Sourcepub fn pop_front(&mut self, pool: &mut GlobalNodePool) -> Option<BuddyBlock>
pub fn pop_front(&mut self, pool: &mut GlobalNodePool) -> Option<BuddyBlock>
Pop an element from the front of the list
Sourcepub fn find_by_addr(
&self,
pool: &GlobalNodePool,
addr: usize,
) -> Option<(usize, Option<usize>)>
pub fn find_by_addr( &self, pool: &GlobalNodePool, addr: usize, ) -> Option<(usize, Option<usize>)>
Find a node by address (for buddy system)
Returns (node_idx, prev_idx) where prev_idx is the node before it (or None if head)
Sourcepub fn remove(&mut self, pool: &mut GlobalNodePool, node_idx: usize) -> bool
pub fn remove(&mut self, pool: &mut GlobalNodePool, node_idx: usize) -> bool
Remove a node at the given index
Sourcepub fn remove_with_prev(
&mut self,
pool: &mut GlobalNodePool,
node_idx: usize,
prev_idx: Option<usize>,
) -> bool
pub fn remove_with_prev( &mut self, pool: &mut GlobalNodePool, node_idx: usize, prev_idx: Option<usize>, ) -> bool
Remove a node using known prev_idx (O(1) operation)
This is used when we already know the previous node index from find_by_addr(), avoiding a second traversal of the list.
Sourcepub fn iter<'a>(&'a self, pool: &'a GlobalNodePool) -> PooledListIter<'a> ⓘ
pub fn iter<'a>(&'a self, pool: &'a GlobalNodePool) -> PooledListIter<'a> ⓘ
Get iterator over elements
Sourcepub fn clear(&mut self, pool: &mut GlobalNodePool)
pub fn clear(&mut self, pool: &mut GlobalNodePool)
Clear all nodes from the list
Returns all nodes to the global pool