Struct crossbeam_epoch::sync::list::List

source ·
pub(crate) struct List<T, C: IsElement<T> = T> {
    head: Atomic<Entry>,
    _marker: PhantomData<(T, C)>,
}
Expand description

A lock-free, intrusive linked list of type T.

Fields§

§head: Atomic<Entry>

The head of the linked list.

§_marker: PhantomData<(T, C)>

The phantom data for using T and C.

Implementations§

source§

impl<T, C: IsElement<T>> List<T, C>

source

pub(crate) fn new() -> Self

Returns a new, empty linked list.

source

pub(crate) unsafe fn insert<'g>( &'g self, container: Shared<'g, T>, guard: &'g Guard, )

Inserts entry into the head of the list.

§Safety

You should guarantee that:

  • container is not null
  • container is immovable, e.g. inside an Owned
  • the same Entry is not inserted more than once
  • the inserted object will be removed before the list is dropped
source

pub(crate) fn iter<'g>(&'g self, guard: &'g Guard) -> Iter<'g, T, C>

Returns an iterator over all objects.

§Caveat

Every object that is inserted at the moment this function is called and persists at least until the end of iteration will be returned. Since this iterator traverses a lock-free linked list that may be concurrently modified, some additional caveats apply:

  1. If a new object is inserted during iteration, it may or may not be returned.
  2. If an object is deleted during iteration, it may or may not be returned.
  3. The iteration may be aborted when it lost in a race condition. In this case, the winning thread will continue to iterate over the same list.

Trait Implementations§

source§

impl<T: Debug, C: Debug + IsElement<T>> Debug for List<T, C>

source§

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

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

impl<T, C: IsElement<T>> Drop for List<T, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, C = T> !Freeze for List<T, C>

§

impl<T, C> RefUnwindSafe for List<T, C>

§

impl<T, C> Send for List<T, C>
where T: Send, C: Send,

§

impl<T, C> Sync for List<T, C>
where T: Sync, C: Sync,

§

impl<T, C> Unpin for List<T, C>
where T: Unpin, C: Unpin,

§

impl<T, C> UnwindSafe for List<T, C>
where T: UnwindSafe, C: 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> Pointable for T

source§

const ALIGN: usize = const ALIGN: usize = mem::align_of::<T>();

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.