Skip to main content

FixedThreadLocalPool

Struct FixedThreadLocalPool 

Source
pub struct FixedThreadLocalPool<T: PoolItem, const N: usize>(/* private fields */);
Expand description

Per-thread pool with capacity N fixed at compile time.

N limits locally retained entries, not active guards. Remote returns may temporarily exceed N; older overflow is discarded when the queue drains.

UnsafeCell removes dynamic borrow tracking from the hot path. Every private access is short and never invokes client code or drops an entry. The storage itself cannot be shared between threads; use its TLS key. When calling PoolProvider directly, return entries through the same key used to acquire them. FixedThreadLocalPoolGuard retains that key automatically.

ⓘ
use rylv_pool::{FixedThreadLocalPool, PoolItem};
fn require_sync<T: Sync>() {}
require_sync::<FixedThreadLocalPool<Item, 1>>();

Implementations§

Source§

impl<T: PoolItem, const N: usize> FixedThreadLocalPool<T, N>

Source

pub fn new() -> Self

Create empty storage for each thread that initializes this value.

Trait Implementations§

Source§

impl<T: PoolItem, const N: usize> Default for FixedThreadLocalPool<T, N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T, const N: usize> !Freeze for FixedThreadLocalPool<T, N>

§

impl<T, const N: usize> !RefUnwindSafe for FixedThreadLocalPool<T, N>

§

impl<T, const N: usize> !Sync for FixedThreadLocalPool<T, N>

§

impl<T, const N: usize> Send for FixedThreadLocalPool<T, N>
where UnsafeCell<ThreadLocalStorage<T, N>>: Send,

§

impl<T, const N: usize> Unpin for FixedThreadLocalPool<T, N>
where UnsafeCell<ThreadLocalStorage<T, N>>: Unpin,

§

impl<T, const N: usize> UnsafeUnpin for FixedThreadLocalPool<T, N>
where UnsafeCell<ThreadLocalStorage<T, N>>: UnsafeUnpin,

§

impl<T, const N: usize> UnwindSafe for FixedThreadLocalPool<T, N>
where UnsafeCell<ThreadLocalStorage<T, N>>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.