Trait tokio::util::linked_list::Link

source ·
pub(crate) unsafe trait Link {
    type Handle;
    type Target;

    // Required methods
    fn as_raw(handle: &Self::Handle) -> NonNull<Self::Target>;
    unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle;
    unsafe fn pointers(
        target: NonNull<Self::Target>,
    ) -> NonNull<Pointers<Self::Target>>;
}
Expand description

Defines how a type is tracked within a linked list.

In order to support storing a single type within multiple lists, accessing the list pointers is decoupled from the entry type.

§Safety

Implementations must guarantee that Target types are pinned in memory. In other words, when a node is inserted, the value will not be moved as long as it is stored in the list.

Required Associated Types§

source

type Handle

Handle to the list entry.

This is usually a pointer-ish type.

source

type Target

Node type.

Required Methods§

source

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

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

source

unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle

Convert the raw pointer to a handle

source

unsafe fn pointers( target: NonNull<Self::Target>, ) -> NonNull<Pointers<Self::Target>>

Return the pointers for a node

§Safety

The resulting pointer should have the same tag in the stacked-borrows stack as the argument. In particular, the method may not create an intermediate reference in the process of creating the resulting raw pointer.

Object Safety§

This trait is not object safe.

Implementors§

§Safety

Waiter is forced to be !Unpin.

§Safety

Waiter is forced to be !Unpin.

§Safety

Waiter is forced to be !Unpin.

§Safety

Tasks are pinned.

§Safety

ListEntry is forced to be !Unpin.