Struct basedrop::Node[][src]

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

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

impl<T: Send + 'static> Node<T>[src]

pub fn alloc(handle: &Handle, data: T) -> *mut Node<T>[src]

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);

impl<T> Node<T>[src]

pub unsafe fn queue_drop(node: *mut Node<T>)[src]

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);
}

pub unsafe fn handle(node: *mut Node<T>) -> Handle[src]

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

impl<T> !Send for Node<T>

impl<T> !Sync for Node<T>

impl<T> Unpin for Node<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.