Trait linked_list::Wrapper

source ·
pub trait Wrapper<T: ?Sized> {
    // Required methods
    fn into_pointer(self) -> NonNull<T>;
    unsafe fn from_pointer(ptr: NonNull<T>) -> Self;
    fn as_ref(&self) -> &T;
}
Expand description

Wraps an object to be inserted in a linked list.

Required Methods§

source

fn into_pointer(self) -> NonNull<T>

Converts the wrapped object into a pointer that represents it.

source

unsafe fn from_pointer(ptr: NonNull<T>) -> Self

Converts the object back from the pointer representation.

Safety

The passed pointer must come from a previous call to Wrapper::into_pointer().

source

fn as_ref(&self) -> &T

Returns a reference to the wrapped object.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: ?Sized> Wrapper<T> for &T

source§

fn into_pointer(self) -> NonNull<T>

source§

unsafe fn from_pointer(ptr: NonNull<T>) -> Self

source§

fn as_ref(&self) -> &T

source§

impl<T: ?Sized> Wrapper<T> for Box<T>

source§

fn into_pointer(self) -> NonNull<T>

source§

unsafe fn from_pointer(ptr: NonNull<T>) -> Self

source§

fn as_ref(&self) -> &T

source§

impl<T: ?Sized> Wrapper<T> for Arc<T>

source§

fn into_pointer(self) -> NonNull<T>

source§

unsafe fn from_pointer(ptr: NonNull<T>) -> Self

source§

fn as_ref(&self) -> &T

Implementors§