Struct tokio::util::idle_notified_set::ListEntry

source ·
struct ListEntry<T> {
    pointers: Pointers<ListEntry<T>>,
    parent: Arc<Mutex<ListsInner<T>>>,
    value: UnsafeCell<ManuallyDrop<T>>,
    my_list: UnsafeCell<List>,
    _pin: PhantomPinned,
}
Expand description

An entry in the list.

§Safety

The my_list field must only be accessed while holding the mutex in parent. It is an invariant that the value of my_list corresponds to which linked list in the parent holds this entry. Once this field takes the value Neither, then it may never be modified again.

If the value of my_list is Notified or Idle, then the pointers field must only be accessed while holding the mutex. If the value of my_list is Neither, then the pointers field may be accessed by the IdleNotifiedSet (this happens inside drain).

The value field is owned by the IdleNotifiedSet and may only be accessed by the IdleNotifiedSet. The operation that sets the value of my_list to Neither assumes ownership of the value, and it must either drop it or move it out from this entry to prevent it from getting leaked. (Since the two linked lists are emptied in the destructor of IdleNotifiedSet, the value should not be leaked.)

Fields§

§pointers: Pointers<ListEntry<T>>

The linked list pointers of the list this entry is in.

§parent: Arc<Mutex<ListsInner<T>>>

Pointer to the shared Lists struct.

§value: UnsafeCell<ManuallyDrop<T>>

The value stored in this entry.

§my_list: UnsafeCell<List>

Used to remember which list this entry is in.

§_pin: PhantomPinned

Required by the linked_list::Pointers field.

Implementations§

Trait Implementations§

§Safety

ListEntry is forced to be !Unpin.

§

type Handle = Arc<ListEntry<T>>

Handle to the list entry. Read more
§

type Target = ListEntry<T>

Node type.
source§

fn as_raw(handle: &Self::Handle) -> NonNull<ListEntry<T>>

Convert the handle to a raw pointer without consuming the handle.
source§

unsafe fn from_raw(ptr: NonNull<ListEntry<T>>) -> Arc<ListEntry<T>>

Convert the raw pointer to a handle
source§

unsafe fn pointers( target: NonNull<ListEntry<T>>, ) -> NonNull<Pointers<ListEntry<T>>>

Return the pointers for a node Read more
source§

impl<T: 'static> Wake for ListEntry<T>

source§

fn wake_by_ref(me: &Arc<Self>)

Wake by reference.
source§

fn wake(me: Arc<Self>)

Wake by value.
source§

impl<T> Send for ListEntry<T>

source§

impl<T> Sync for ListEntry<T>

Auto Trait Implementations§

§

impl<T> !Freeze for ListEntry<T>

§

impl<T> !RefUnwindSafe for ListEntry<T>

§

impl<T> !Unpin for ListEntry<T>

§

impl<T> !UnwindSafe for ListEntry<T>

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

§

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.