pub struct MemoryPool { /* private fields */ }Expand description
High-performance memory pool for dataset generation
Implementations§
Source§impl MemoryPool
impl MemoryPool
Sourcepub fn new(config: MemoryPoolConfig) -> Self
pub fn new(config: MemoryPoolConfig) -> Self
Create a new memory pool
Sourcepub fn allocate(&self, size: usize) -> MemoryPoolResult<PooledBlock>
pub fn allocate(&self, size: usize) -> MemoryPoolResult<PooledBlock>
Allocate a block of memory
Sourcepub fn deallocate(&self, block_id: usize, size: usize) -> MemoryPoolResult<()>
pub fn deallocate(&self, block_id: usize, size: usize) -> MemoryPoolResult<()>
Deallocate a block of memory
Sourcepub fn stats(&self) -> MemoryPoolStats
pub fn stats(&self) -> MemoryPoolStats
Get pool statistics
Sourcepub fn allocate_array2(
&self,
nrows: usize,
ncols: usize,
) -> MemoryPoolResult<PooledArray2>
pub fn allocate_array2( &self, nrows: usize, ncols: usize, ) -> MemoryPoolResult<PooledArray2>
Allocate memory for a 2D array
Sourcepub fn allocate_array1(&self, len: usize) -> MemoryPoolResult<PooledArray1>
pub fn allocate_array1(&self, len: usize) -> MemoryPoolResult<PooledArray1>
Allocate memory for a 1D array
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MemoryPool
impl RefUnwindSafe for MemoryPool
impl Send for MemoryPool
impl Sync for MemoryPool
impl Unpin for MemoryPool
impl UnsafeUnpin for MemoryPool
impl UnwindSafe for MemoryPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more