Struct basedrop::Node [−][src]
#[repr(C)]pub struct Node<T> { pub data: T, // some fields omitted }
Expand description
Fields
data: T
The data stored in this allocation.
Implementations
Allocates a Node
with the given data. Note that the Node
will not
be added to the drop queue or freed unless queue_drop
is called.
Examples
use basedrop::{Collector, Handle, Node}; let mut collector = Collector::new(); let handle = collector.handle(); let node = Node::alloc(&handle, 3);
Adds a Node
to its associated Collector
’s drop queue. The Node
and its contained data may be dropped at a later time when
Collector::collect
or Collector::collect_one
is called.
The argument must point to a valid Node
previously allocated with
Node::alloc
. queue_drop
may only be called once for a given
Node
, and the Node
’s data must not be accessed afterwards.
Examples
use basedrop::{Collector, Handle, Node}; let mut collector = Collector::new(); let handle = collector.handle(); let node = Node::alloc(&handle, 3); unsafe { Node::queue_drop(node); }
Gets a Handle
to this Node
’s associated Collector
.
The argument must point to a valid Node
previously allocated with
Node::alloc
, on which queue_drop
has not been called.