Skip to main content

BatchedRetire

Struct BatchedRetire 

Source
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

Source

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
  • ptr must be a valid value pointer for slot type S
  • ptr must not be accessed after this call
§Example
if S::NEEDS_RETIREMENT {
    unsafe {
        BatchedRetire::defer_value::<S>(old_ptr, guard);
    }
}
Source

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
  • ptr must be valid for the provided cleanup_fn
  • ptr must not be accessed after this call
  • cleanup_fn must correctly clean up the pointer
Source

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
Source

pub const fn pending() -> usize

Get the number of pending retirements (always 0 in current implementation).

Since retirement is delegated directly to seize, there are no pending retirements at this level.

Trait Implementations§

Source§

impl Debug for BatchedRetire

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.