Skip to main content

SharedLinkedList

Struct SharedLinkedList 

Source
pub struct SharedLinkedList<T: Copy + Default + 'static> { /* private fields */ }

Implementations§

Source§

impl<T: Copy + Default + 'static> SharedLinkedList<T>

Source

pub fn create( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, LinkedListError>

Source

pub fn open( path: impl AsRef<Path>, capacity: usize, ) -> Result<Self, LinkedListError>

Source

pub fn capacity(&self) -> usize

Source

pub fn len(&self) -> usize

Approximate node count (excludes the sentinel head).

Source

pub fn is_empty(&self) -> bool

Source

pub fn region(&self) -> &SharedRegion<Node<T>>

Access the underlying region (advanced use; e.g., to wrap writes in a SharedSemaphore for cross-process serialisation).

Source

pub fn push_front(&self, value: T) -> Result<NodeHandle<T>, LinkedListError>

Push to the front of the list. Returns a stable NodeHandle.

Source

pub fn push_back(&self, value: T) -> Result<NodeHandle<T>, LinkedListError>

Push to the back of the list. Returns a stable NodeHandle.

Source

pub fn pop_front(&self) -> Option<T>

Remove and return the first element.

Source

pub fn pop_back(&self) -> Option<T>

Remove and return the last element.

Source

pub fn remove(&self, handle: NodeHandle<T>) -> Option<T>

Remove the node referenced by handle in O(1) (splice + free the slot). Returns the removed value or None when the handle is the sentinel head OR was already freed.

Source

pub fn get(&self, handle: NodeHandle<T>) -> Option<T>

Read the value at handle. Returns None for nil or stale handle (after remove).

Source

pub fn set( &self, handle: NodeHandle<T>, value: T, ) -> Result<(), LinkedListError>

Overwrite the value at handle (keeping the node’s position in the list).

Source

pub fn first(&self) -> Option<T>

First node’s value (None if empty).

Source

pub fn last(&self) -> Option<T>

Last node’s value (None if empty).

Source

pub fn iter_forward(&self) -> Vec<T>

Snapshot of all values in forward order.

Source

pub fn iter_backward(&self) -> Vec<T>

Snapshot of all values in reverse order (back to front).

Source

pub fn iter_forward_with_handles(&self) -> Vec<(NodeHandle<T>, T)>

Snapshot of all (handle, value) pairs in forward order. Useful for finding a handle by predicate, then removing it.

Source

pub fn flush(&self) -> Result<(), LinkedListError>

Source

pub fn flush_async(&self) -> Result<(), LinkedListError>

Trait Implementations§

Source§

impl<T: Copy + Default + Send + Sync + 'static> AdaptiveInstance for SharedLinkedList<T>

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

fn apply_migration(&self, new_tag: u32)

Called by the sidecar when the policy returns a new strategy tag. Default implementation: just set the tag on the header. Primitives that need heavier migration (data-layout swap) override this to perform the swap before (or after) updating the tag.

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.