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§
Required Methods§
sourcefn as_raw(handle: &Self::Handle) -> NonNull<Self::Target>
fn as_raw(handle: &Self::Handle) -> NonNull<Self::Target>
Convert the handle to a raw pointer without consuming the handle.
sourceunsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle
unsafe fn from_raw(ptr: NonNull<Self::Target>) -> Self::Handle
Convert the raw pointer to a handle
sourceunsafe fn pointers(
target: NonNull<Self::Target>,
) -> NonNull<Pointers<Self::Target>>
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.