pub struct BatchedRetire;Expand description
Batched retirement utilities.
Provides a consistent API for retirement operations. Currently delegates
directly to seize’s defer_retire, which already performs internal batching.
Implementations§
Source§impl BatchedRetire
impl BatchedRetire
Sourcepub unsafe fn defer_value<S: ValueSlot>(ptr: *mut u8, guard: &LocalGuard<'_>)
pub unsafe fn defer_value<S: ValueSlot>(ptr: *mut u8, guard: &LocalGuard<'_>)
Defer retirement of a value using S::cleanup_value_ptr.
This is the main entry point for value retirement in the tree.
§Safety
ptrmust be a valid value pointer for slot typeSptrmust not be accessed after this call
§Example
ⓘ
if S::NEEDS_RETIREMENT {
unsafe {
BatchedRetire::defer_value::<S>(old_ptr, guard);
}
}Sourcepub unsafe fn defer_custom<T>(
ptr: *mut T,
cleanup_fn: unsafe fn(*mut T, &Collector),
guard: &LocalGuard<'_>,
)
pub unsafe fn defer_custom<T>( ptr: *mut T, cleanup_fn: unsafe fn(*mut T, &Collector), guard: &LocalGuard<'_>, )
Defer retirement with a custom cleanup function.
Use this for suffix bags, nodes, and other non-value retirements.
§Safety
ptrmust be valid for the providedcleanup_fnptrmust not be accessed after this callcleanup_fnmust correctly clean up the pointer
Sourcepub fn flush(guard: &LocalGuard<'_>)
pub fn flush(guard: &LocalGuard<'_>)
Flush pending retirements to start reclamation process.
This triggers seize to process any accumulated retirements in the thread-local batch. Note that actual memory reclamation won’t happen until the guard is dropped, but this allows reclamation to proceed more quickly once the guard is released.
§When to Use
- After completing a batch of mutations before starting a long read
- At natural boundaries in your workload
- When you want more predictable reclamation timing
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchedRetire
impl RefUnwindSafe for BatchedRetire
impl Send for BatchedRetire
impl Sync for BatchedRetire
impl Unpin for BatchedRetire
impl UnwindSafe for BatchedRetire
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