Struct empty_box::EmptyBox
[−]
[src]
pub struct EmptyBox<T> { /* fields omitted */ }
An "emptied" Box
. Constructed via EmptyBox::take()
, an EmptyBox<T>
is
a Box
from which the contents have been moved. This allows for reuse of the
Box
via EmptyBox::put()
, which moves the contents back in, turning the
EmptyBox
back into a Box<T>
.
Methods
impl<T> EmptyBox<T>
[src]
fn take(bx: Box<T>) -> (T, EmptyBox<T>)
Move the value out of the Box
, creating a T
and an EmptyBox
which
preserves the original Box
's allocation.
fn put(self, t: T) -> Box<T>
Restore a value to an EmptyBox
, creating a new Box
and reusing the
allocation of whatever Box
was destroyed to create the EmptyBox
.