RefCellBox

Struct RefCellBox 

Source
pub struct RefCellBox<T, F, W>
where F: Emitter<T>, W: Handler<RefCell<T>>,
{ /* private fields */ }
Expand description

Holds a list of allocated objects in a scalable pool. Previously allocated objects can be checked back in after use, to prevent immediate deallocation.

Implementations§

Source§

impl<T, F, W> RefCellBox<T, F, W>
where F: Emitter<T>, W: Handler<RefCell<T>>,

Source

pub fn new( unused_pool: Vec<Box<RefCell<T>>>, new_gen: F, grow_size: u8, washer: W, ) -> RefCellBox<T, F, W>

Creates a new RefCellBox.

Source

pub fn unused_pool_size(&self) -> usize

Gets the current number of un-checked-out items in the pool. The current “reserve” size.

Source

pub fn expand(&mut self)

Grows the RefCellBox pool by the previously specified quantity.

Trait Implementations§

Source§

impl<T, F, W> HeapPool<Box<RefCell<T>>> for RefCellBox<T, F, W>
where F: Emitter<T>, W: Handler<RefCell<T>>,

Source§

fn check_out(&mut self) -> Box<RefCell<T>>

Get a value from the HeapPool.
Source§

fn check_in(&mut self, container: Box<RefCell<T>>)

Give a value back to the HeapPool.

Auto Trait Implementations§

§

impl<T, F, W> Freeze for RefCellBox<T, F, W>
where F: Freeze, W: Freeze,

§

impl<T, F, W> !RefUnwindSafe for RefCellBox<T, F, W>

§

impl<T, F, W> Send for RefCellBox<T, F, W>
where F: Send, W: Send, T: Send,

§

impl<T, F, W> !Sync for RefCellBox<T, F, W>

§

impl<T, F, W> Unpin for RefCellBox<T, F, W>
where F: Unpin, W: Unpin,

§

impl<T, F, W> UnwindSafe for RefCellBox<T, F, W>
where F: UnwindSafe, W: UnwindSafe, T: 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 = 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.