[−][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, S> Pool<A, S> where
S: PoolSyncType<A>,
[src]
S: PoolSyncType<A>,
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 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.
pub fn fill(&self)
[src]
Fill the pool with empty allocations.
This operation will pre-allocate self.get_max_size() - self.get_pool_size()
memory chunks, without initialisation, and put
them in the pool.
Trait Implementations
impl<A, S> Clone for Pool<A, S> where
S: PoolSyncType<A>,
[src]
S: PoolSyncType<A>,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A, S> Drop for Pool<A, S> where
S: PoolSyncType<A>,
[src]
S: PoolSyncType<A>,
Auto Trait Implementations
impl<A, S> RefUnwindSafe for Pool<A, S> where
<S as PoolSyncType<A>>::PoolPointer: RefUnwindSafe,
<S as PoolSyncType<A>>::PoolPointer: RefUnwindSafe,
impl<A, S> Send for Pool<A, S> where
<S as PoolSyncType<A>>::PoolPointer: Send,
<S as PoolSyncType<A>>::PoolPointer: Send,
impl<A, S> Sync for Pool<A, S> where
<S as PoolSyncType<A>>::PoolPointer: Sync,
<S as PoolSyncType<A>>::PoolPointer: Sync,
impl<A, S> Unpin for Pool<A, S> where
<S as PoolSyncType<A>>::PoolPointer: Unpin,
<S as PoolSyncType<A>>::PoolPointer: Unpin,
impl<A, S> UnwindSafe for Pool<A, S> where
<S as PoolSyncType<A>>::PoolPointer: UnwindSafe,
<S as PoolSyncType<A>>::PoolPointer: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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>,