[−][src]Struct refpool::Pool
A pool of preallocated memory sized to match type A
.
In order to use it to allocate objects, pass it to
PoolRef::new()
or PoolRef::default()
.
Example
let mut pool: Pool<usize> = Pool::new(1024); let pool_ref = PoolRef::new(&mut pool, 31337); assert_eq!(31337, *pool_ref);
Methods
impl<A> Pool<A>
[src]
pub fn new(max_size: usize) -> Self
[src]
Construct a new pool with a given max size.
pub fn get_max_size(&self) -> usize
[src]
Get the maximum size of the pool.
pub fn set_max_size(&mut self, max_size: usize)
[src]
Set a new max size for the pool.
This will not reduce the size of the pool if you set it to a lower number than its current size, but it will prevent it from growing while the pool size exceeds the new max size.
pub fn get_pool_size(&self) -> usize
[src]
Get the current size of the pool.
pub fn is_full(&self) -> bool
[src]
Test if the pool is currently full.
Auto Trait Implementations
impl<A> !Send for Pool<A>
impl<A> !Sync for Pool<A>
impl<A> Unpin for Pool<A>
impl<A> UnwindSafe for Pool<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
impl<A> RefUnwindSafe for Pool<A> where
A: RefUnwindSafe,
A: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,