Skip to main content

ThreadLocalState

Struct ThreadLocalState 

Source
#[doc(hidden)]
pub struct ThreadLocalState<M: MapStorage> { pub inner: ArenaState<M>, pub initialized: bool, }
Expand description

State wrapper for thread-local arenas (used by macro).

Fields§

§inner: ArenaState<M>§initialized: bool

Implementations§

Source§

impl<M: MapStorage> ThreadLocalState<M>

Source

pub const fn uninit() -> Self

Create an uninitialized thread-local arena state.

Call init or init_with_capacity before use.

Source

pub unsafe fn init(&mut self)

Initialize with default capacity (16 slots).

For ppsize-scale workloads, prefer init_with_capacity to avoid backing VECSXP growth and map rehashing during operation.

§Safety

Must be called from the R main thread. Must only be called once.

Source

pub unsafe fn init_with_capacity(&mut self, capacity: usize)

Initialize with specific capacity.

Pre-sizing avoids growth of the backing VECSXP and rehashing of the internal map. Use this when the expected number of distinct protected values is known or can be estimated (e.g., the length of an input vector).

§Safety

Must be called from the R main thread. Must only be called once.

Trait Implementations§

Source§

impl<M: MapStorage> Drop for ThreadLocalState<M>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.