pub struct Node<T> {
pub data: T,
/* private fields */
}Expand description
Fields§
§data: TThe data stored in this allocation.
Implementations§
Source§impl<T: Send + 'static> Node<T>
impl<T: Send + 'static> Node<T>
Sourcepub fn alloc(handle: &Handle, data: T) -> *mut Node<T>
pub fn alloc(handle: &Handle, data: T) -> *mut Node<T>
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);Source§impl<T> Node<T>
impl<T> Node<T>
Sourcepub unsafe fn queue_drop(node: *mut Node<T>)
pub unsafe fn queue_drop(node: *mut Node<T>)
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);
}Sourcepub unsafe fn handle(node: *mut Node<T>) -> Handle
pub unsafe fn handle(node: *mut Node<T>) -> Handle
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> !Freeze for Node<T>
impl<T> RefUnwindSafe for Node<T>where
T: RefUnwindSafe,
impl<T> !Send for Node<T>
impl<T> !Sync for Node<T>
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> UnwindSafe for Node<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more