Skip to main content

RcuList

Struct RcuList 

Source
pub struct RcuList<T: Send + Sync + 'static, A: RcuListAdapter<T>> { /* private fields */ }
Expand description

An RcuList is a doubly-linked list that supports concurrent access via read-copy-update (RCU) synchronization.

An RcuList can be safely read by multiple readers, even while a writer is modifying the list. To read from the list, you will need to enter an RcuReadScope.

To modify the list, you will need to use some external synchronization, such as a Mutex, to exclude concurrent writers.

Implementations§

Source§

impl<T: Send + Sync + 'static, A: RcuListAdapter<T>> RcuList<T, A>

Source

pub fn new(head: RcuPtr<Link>, tail: RcuPtr<Link>) -> Self

Creates a new list with the given head and tail.

Source

pub unsafe fn push_front<'a>( &self, scope: &'a RcuReadScope, data: T, ) -> RcuPtrRef<'a, T>

Pushes a new element to the front of the list.

§Safety

Requires external synchronization to exclude concurrent writers.

Source

pub unsafe fn push_back<'a>( &self, scope: &'a RcuReadScope, data: T, ) -> RcuPtrRef<'a, T>

Pushes a new element to the back of the list.

§Safety

Requires external synchronization to exclude concurrent writers.

Source

pub unsafe fn append(&self, scope: &RcuReadScope, other: Self)

Appends another list to the end of this list.

§Safety

Requires external synchronization to exclude concurrent writers.

Source

pub unsafe fn split_off(&self, scope: &RcuReadScope, pos: usize) -> Self

Splits the list into two lists at the given position.

If the given position is past the end of the list, returns an empty list.

§Safety

Requires external synchronization to exclude concurrent writers.

Source

pub unsafe fn clear(&self)

Removes all elements from the list.

Concurrent readers may continue to see the old value of the list until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.

§Safety

Requires external synchronization to exclude concurrent writers.

Source

pub fn cursor<'a>(&'a self, scope: &'a RcuReadScope) -> RcuListCursor<'a, T, A>

Returns a cursor that can be used to traverse and modify the list.

Concurrent readers may continue to see the old value of the list until the RCU state machine has made sufficient progress to ensure that no concurrent readers are holding read guards.

Source

pub fn iter<'a>(&self, scope: &'a RcuReadScope) -> impl Iterator<Item = &'a T>

Returns an iterator over the elements in the list.

Trait Implementations§

Source§

impl<T: Debug + Send + Sync + 'static, A: Debug + RcuListAdapter<T>> Debug for RcuList<T, A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Send + Sync + 'static, A: RcuListAdapter<T>> Default for RcuList<T, A>

Source§

fn default() -> Self

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

impl<T: Send + Sync + 'static, A: RcuListAdapter<T>> Drop for RcuList<T, A>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, A> !Freeze for RcuList<T, A>

§

impl<T, A> RefUnwindSafe for RcuList<T, A>

§

impl<T, A> Send for RcuList<T, A>
where A: Send,

§

impl<T, A> Sync for RcuList<T, A>
where A: Sync,

§

impl<T, A> Unpin for RcuList<T, A>
where T: Unpin, A: Unpin,

§

impl<T, A> UnsafeUnpin for RcuList<T, A>

§

impl<T, A> UnwindSafe for RcuList<T, A>
where T: UnwindSafe, A: UnwindSafe,

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.