[][src]Trait lock_free_freelist::SmartPointer

pub unsafe trait SmartPointer: Deref + DerefMut where
    Self::Target: Sized + Reusable
{ pub unsafe fn from_raw(raw: *mut Self::Target) -> Self;
pub fn into_raw(smart_pointer: Self) -> *mut Self::Target;
pub fn new(contents: Self::Target) -> Self; }

Types implementing this trait can be wrapped inside FreeList.

This trait requires the user to guarantee that the type implementing SmartPointer will not use the pointer returned from into_raw() after being dropped.

So, this trait should not be implemented for Arc, Rc etc. becuase the pointer could still be out there after the container is dropped.

For this reason the trait is unsafe.

Required methods

pub unsafe fn from_raw(raw: *mut Self::Target) -> Self[src]

Constructs an instance of Self by a raw pointer.

pub fn into_raw(smart_pointer: Self) -> *mut Self::Target[src]

Consumes Self to return the contained raw pointer. This trait assumes if it extracts the raw pointer using into_raw(), it won't be changed from anywhere else.

pub fn new(contents: Self::Target) -> Self[src]

This method should wrap the arg contents and generate a new instance of Self.

Loading content...

Implementations on Foreign Types

impl<T> SmartPointer for Box<T> where
    Self::Target: Sized + Reusable
[src]

Loading content...

Implementors

Loading content...