Expand description
Provides a way of deallocating a value using a heap-allocated queue to traverse fields instead of stack recursion.
This effectively does nothing for types which implement Copy, e.g.
integers. Such values are copied and then moved into the function, so the
value persists after this function call.
§Examples
Basic usage:
use heap_drop::{HeapDrop, heap_drop};
#[derive(HeapDrop)]
struct Node(Option<Box<Node>>);
let v = Node(Some(Box::new(Node(None /* could be a very deep structure */))));
heap_drop(v);Traits§
- Heap
Drop - A trait that allows a type to be disposed of using a heap-allocated queue instead of the stack.
Functions§
- heap_
drop - Disposes of a value using a heap-allocated queue to traverse fields instead of the stack.
Derive Macros§
- Heap
Drop - Derives the
HeapDroptrait for a struct or enum, allowing it to be disposed of using a heap-allocated queue.