Struct containerof::OwnBox
[−]
[src]
pub struct OwnBox<T> { /* fields omitted */ }
Represent ownership of an object via ownership of an intrusive
field within the object. Differs from Rust-standard Box<T>
in
that dropping an OwnBox<T>
instance is a bug.
Methods
impl<T> OwnBox<T>
[src]
fn get_address(&self) -> usize
Get value pointer address.
unsafe fn from_alias(pointer: IntrusiveAlias) -> OwnBox<T>
Construct an OwnBox from an IntrusiveAlias pointer. Unsafe because this allows trivial construction of pointer aliases.
unsafe fn into_alias(self) -> IntrusiveAlias
Move ownership of an OwnBox into an IntrusiveAlias pointer. Unsafe because this allows trivial construction of pointer aliases.
unsafe fn as_alias<'a>(&'a self) -> &'a IntrusiveAlias
Return a borrow-pointer of an IntrusiveAlias with same address as the OwnBox. Unsafe because working with IntrusiveAlias structures (that is, raw pointers) is unsafe.
fn from_box(b: Box<T>) -> OwnBox<T>
Construct an OwnBox from a Box.
unsafe fn into_box(self) -> Box<T>
Construct a Box from an OwnBox. Should only be called on an
OwnBox that was constructed via from_box (or
convert::From
Trait Implementations
impl<T> From<Box<T>> for OwnBox<T>
[src]
impl<T> Deref for OwnBox<T>
[src]
type Target = T
The resulting type after dereferencing
fn deref<'a>(&'a self) -> &'a T
The method called to dereference a value
impl<T> DerefMut for OwnBox<T>
[src]
fn deref_mut<'a>(&'a mut self) -> &'a mut T
The method called to mutably dereference a value