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

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

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

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

Provided Methods

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.

Implementations on Foreign Types

Implementors