MemoryPool

Struct MemoryPool 

Source
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

Source

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

Source

pub const unsafe fn from_raw_nonnull(id: NonNullID) -> Self

Construct a MemoryPool from a raw object ID.

§Safety

See Object ID Wrappers.

Source

pub const fn leak<'a>(self) -> MemoryPoolRef<'a>

Consume and “leak” self, returning a reference MemoryPoolRef<'a>.

Source

pub const fn as_raw(&self) -> ID

Get the raw object ID.

Source

pub const fn as_raw_nonnull(&self) -> NonNullID

Get the raw object ID as abi::NonNullID.

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for MemoryPool

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for MemoryPool

Source§

fn eq(&self, other: &MemoryPool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for MemoryPool

Source§

impl StructuralPartialEq for MemoryPool

Auto Trait Implementations§

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.
Source§

impl<T> Unknown for T
where T: ?Sized,