Trait intrusive_collections::IntrusivePointer [] [src]

pub unsafe trait IntrusivePointer<T: ?Sized> {
    fn into_raw(self) -> *const T;
    unsafe fn from_raw(ptr: *const T) -> Self;
}

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

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

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

Implementors