Struct basedrop::Node [−][src]
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
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,