Skip to main content

PooledLinkedList

Struct PooledLinkedList 

Source
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

Source

pub const fn new() -> Self

Create a new empty pooled linked list

Source

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

Source

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)

Source

pub fn pop_front(&mut self, pool: &mut GlobalNodePool) -> Option<BuddyBlock>

Pop an element from the front of the list

Source

pub fn is_empty(&self) -> bool

Check if the list is empty

Source

pub fn len(&self) -> usize

Get the length of the list

Source

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)

Source

pub fn remove(&mut self, pool: &mut GlobalNodePool, node_idx: usize) -> bool

Remove a node at the given index

Source

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.

Source

pub fn iter<'a>(&'a self, pool: &'a GlobalNodePool) -> PooledListIter<'a>

Get iterator over elements

Source

pub fn clear(&mut self, pool: &mut GlobalNodePool)

Clear all nodes from the list

Returns all nodes to the global pool

Trait Implementations§

Source§

impl Default for PooledLinkedList

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.