Trait rustpython_common::linked_list::Link
source · 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§
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.