Struct Pool

Source
pub struct Pool<const S: usize, T: 'static> { /* private fields */ }
Expand description

A sharded pool of elements.

Implementations§

Source§

impl<T: Default + Reuse> Pool<{ 32 }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<T: Default + Reuse> Pool<{ _ }, T>

Source

pub const fn new(limit: usize, trim: usize) -> Self

Source§

impl<const S: usize, T: Default + Reuse> Pool<S, T>

Source

pub fn get(&'static self) -> Pooled<T>

Get a value from the pool, or create a new default value if the assigned shard is currently empty.

Source

pub fn get_empty(&'static self) -> Pooled<T>

Create a new default value assigned for a pool, if it is ends up being expanded and eligible for reuse it will return to the pool, otherwise it will end up being dropped.

Source

pub fn get_with(&'static self, f: impl Fn(&mut T)) -> Pooled<T>

Get a value from the pool and apply the provided transformation on it before returning.

Source

pub fn from_owned(&'static self, inner: T) -> Pooled<T>

Source§

impl<'a, const S: usize, T: Default + Extend<&'a u8> + Reuse> Pool<S, T>

Source

pub fn with_slice(&'static self, v: &'a [u8]) -> Pooled<T>

Get a value from the pool and extend it with the provided slice.

Trait Implementations§

Source§

impl<const S: usize, T: Debug + 'static> Debug for Pool<S, T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const S: usize, T> !Freeze for Pool<S, T>

§

impl<const S: usize, T> RefUnwindSafe for Pool<S, T>

§

impl<const S: usize, T> Send for Pool<S, T>
where T: Send,

§

impl<const S: usize, T> Sync for Pool<S, T>
where T: Send,

§

impl<const S: usize, T> Unpin for Pool<S, T>
where T: Unpin,

§

impl<const S: usize, T> UnwindSafe for Pool<S, T>

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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.