[−][src]Type Definition swim_mem::lease::PtrBox
type PtrBox<'a, T, M = ()> = Ptr<'a, Box<T, M>>;
Exclusive reference to a value stored in a Hold
-allocated memory block,
with optional metadata stored inside the allocation.
Storing metadata in the memory block keeps the pointer structure exactly the size of a pointer.
Examples
Move a value from the stack to the global hold by creating a PtrBox
:
let value = 5; let boxed = PtrBox::new(value);
Move a value from a PtrBox
back to the stack by dereferencing:
let boxed = PtrBox::new(5); let value = *boxed;