Skip to main content

SymbolPool

Struct SymbolPool 

Source
pub struct SymbolPool { /* private fields */ }
Expand description

A pool of fixed-size symbol buffers.

Implementations§

Source§

impl SymbolPool

Source

pub fn new(config: PoolConfig) -> Self

Creates a new symbol pool using the provided configuration.

br-asupersync-jpzl5a — Mints pool_id from a process-global counter. This is fine for accounting / back-pressure decisions where the only contract is “distinct pools have distinct ids”, but it leaks ambient identity that breaks deterministic replay across separate LabRuntime instances. Determinism-sensitive callers should use Self::new_with_pool_id and supply an ID minted from the runtime-scoped allocator they already hold.

Source

pub fn new_with_pool_id(config: PoolConfig, pool_id: u64) -> Self

br-asupersync-jpzl5a — Creates a new symbol pool with an explicit pool_id. Use this from runtime-scoped factories that want pool identity tied to a deterministic allocator (e.g. a per-runtime counter or a Cx-derived hash) rather than the process-global atomic in Self::new.

Source

pub fn config(&self) -> &PoolConfig

Returns the current pool configuration.

Source

pub fn stats(&self) -> &PoolStats

Returns pool usage statistics.

Source

pub fn free_count(&self) -> usize

Returns the number of buffers currently available in the free list.

Source

pub fn reset_stats(&mut self)

Resets pool statistics while keeping current usage.

Source

pub fn allocate(&mut self) -> Result<SymbolBuffer, PoolExhausted>

Allocates a symbol buffer or returns PoolExhausted.

Source

pub fn try_allocate(&mut self) -> Option<SymbolBuffer>

Attempts to allocate a symbol buffer without blocking.

Source

pub fn deallocate(&mut self, buffer: SymbolBuffer)

Returns a buffer to the pool.

§Panics

Panics if the buffer’s size does not match the pool’s configured symbol size, if it was never checked out from a pool, or if it belongs to a different pool.

Source

pub fn shrink_to_fit(&mut self)

Shrinks the free list to the minimum size based on the initial pool size.

Source

pub fn warm(&mut self, count: usize)

Ensures the pool has at least count free buffers.

Trait Implementations§

Source§

impl Debug for SymbolPool

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V