pub unsafe trait Link {
    type Handle;
    type Target;

    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§

Handle to the list entry.

This is usually a pointer-ish type.

Node type.

Required Methods§

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

Convert the raw pointer to a handle

Return the pointers for a node

Implementors§