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.