Struct basedrop::Node[][src]

#[repr(C)]
pub struct Node<T> { pub data: T, // some fields omitted }
Expand description

An allocation that can be added to its associated Collector’s drop queue.

Node provides a low-level interface intended for use in the implementation of smart pointers and data structure internals. It is used in the implementations of Owned and Shared.

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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.