[][src]Trait intrusive_collections::IntrusivePointer

pub unsafe trait IntrusivePointer<T: ?Sized>: Deref<Target = T> + Sized {
    unsafe fn from_raw(ptr: *const T) -> Self;

    fn into_raw(self) -> *const T { ... }
}

Trait representing an owned pointer type which can be converted to and from a raw pointer.

This trait is automatically implemented for the standard Box, Rc and Arc types. It is also implemented for the UnsafeRef pointer type provided by this crate.

Rust reference types (&T) also implement IntrusivePointer. This is safe because the lifetime of an intrusive collection is limited to that of the pointer type. This means that a collection of &'a T cannot outlive any objects that are inserted into the collection.

Required methods

unsafe fn from_raw(ptr: *const T) -> Self

Constructs an owned pointer from a raw pointer which was previously returned by into_raw.

Loading content...

Provided methods

fn into_raw(self) -> *const T

Consumes the owned pointer and returns a raw pointer to the owned object.

The returned pointer must be the same as the one returned by Deref.

Loading content...

Implementations on Foreign Types

impl<'a, T: ?Sized> IntrusivePointer<T> for &'a T[src]

impl<T: ?Sized> IntrusivePointer<T> for Box<T>[src]

impl<T: ?Sized> IntrusivePointer<T> for Rc<T>[src]

impl<T: ?Sized> IntrusivePointer<T> for Arc<T>[src]

Loading content...

Implementors

impl<T: ?Sized> IntrusivePointer<T> for UnsafeRef<T>[src]

Loading content...