pub struct MemoryPool(/* private fields */);Available on crate features
dcre and unstable only.Expand description
An owned memory pool.
Deletes the memory pool automatically when dropped. The destructor will panic if the deletion fails.
Implementations§
Source§impl MemoryPool
impl MemoryPool
Sourcepub fn build() -> Builder<__block_size_is_not_specified__, __block_count_is_not_specified__>
pub fn build() -> Builder<__block_size_is_not_specified__, __block_count_is_not_specified__>
acre_mpf: Create a builder for MemoryPool.
§Examples
use itron::memorypool::MemoryPool;
let pool = MemoryPool::build()
.block_size(32)
.block_count(4)
.finish()
.expect("failed to create a memory pool");
let block = pool.as_ref().get()
.expect("failed to allocate a block");
pool.as_ref().release(block)
.expect("failed to deallocate a block");Source§impl MemoryPool
impl MemoryPool
Sourcepub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self
pub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self
Sourcepub const fn leak<'a>(self) -> MemoryPoolRef<'a>
pub const fn leak<'a>(self) -> MemoryPoolRef<'a>
Consume and “leak” self, returning a reference MemoryPoolRef<'a>.
Sourcepub const fn as_raw_nonnull(&self) -> NonNullID
pub const fn as_raw_nonnull(&self) -> NonNullID
Get the raw object ID as abi::NonNullID.
Sourcepub const fn as_ref(&self) -> MemoryPoolRef<'_>
pub const fn as_ref(&self) -> MemoryPoolRef<'_>
Borrow MemoryPool as MemoryPoolRef.
Use this to perform operations on memory pools because most of the
methods are implemented on MemoryPoolRef but not MemoryPool.
Trait Implementations§
Source§impl Debug for MemoryPool
impl Debug for MemoryPool
Source§impl Drop for MemoryPool
impl Drop for MemoryPool
Source§impl PartialEq for MemoryPool
impl PartialEq for MemoryPool
impl Eq for MemoryPool
impl StructuralPartialEq for MemoryPool
Auto Trait Implementations§
impl Freeze for MemoryPool
impl RefUnwindSafe for MemoryPool
impl Send for MemoryPool
impl Sync for MemoryPool
impl Unpin 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