Skip to main content

HeapMemoryManager

Struct HeapMemoryManager 

Source
pub struct HeapMemoryManager<P: Payload> { /* private fields */ }
Expand description

A heap-backed fixed-capacity memory manager.

Implementations§

Source§

impl<P: Payload> HeapMemoryManager<P>

Source

pub fn new(capacity: usize) -> Self

Create a new manager with given fixed capacity.

The manager pre-allocates capacity slots, all initially None. memory_class defaults to MemoryClass::Host.

Source

pub fn with_memory_class(capacity: usize, mem_class: MemoryClass) -> Self

Create a new manager with given capacity and explicit memory_class.

Source

pub fn configured_capacity(&self) -> usize

Return the configured capacity.

Trait Implementations§

Source§

impl<P: Payload> HeaderStore for HeapMemoryManager<P>

Source§

type HeaderGuard<'a> = HeapHeaderGuard<'a> where Self: 'a

Guard type returned by HeaderStore::peek_header. Read more
Source§

fn peek_header( &self, token: MessageToken, ) -> Result<Self::HeaderGuard<'_>, MemoryError>

Borrow the header of the message identified by token. Read more
Source§

impl<P: Payload> MemoryManager<P> for HeapMemoryManager<P>

Source§

type ReadGuard<'a> = HeapReadGuard<'a, P> where Self: 'a

Shared read guard returned by MemoryManager::read. Read more
Source§

type WriteGuard<'a> = HeapWriteGuard<'a, P> where Self: 'a

Exclusive mutable guard returned by MemoryManager::read_mut. Read more
Source§

fn store(&mut self, value: Message<P>) -> Result<MessageToken, MemoryError>

Allocate storage for value and return its token. Read more
Source§

fn read(&self, token: MessageToken) -> Result<Self::ReadGuard<'_>, MemoryError>

Borrow a stored message immutably. Read more
Source§

fn read_mut( &mut self, token: MessageToken, ) -> Result<Self::WriteGuard<'_>, MemoryError>

Borrow a stored message mutably. Read more
Source§

fn free(&mut self, token: MessageToken) -> Result<(), MemoryError>

Free the slot identified by token. Read more
Source§

fn available(&self) -> usize

Return the number of currently free slots. Read more
Source§

fn capacity(&self) -> usize

Return the total slot capacity of the manager.
Source§

fn memory_class(&self) -> MemoryClass

Return the memory class represented by this manager. Read more

Auto Trait Implementations§

§

impl<P> Freeze for HeapMemoryManager<P>

§

impl<P> !RefUnwindSafe for HeapMemoryManager<P>

§

impl<P> Send for HeapMemoryManager<P>
where P: Send,

§

impl<P> !Sync for HeapMemoryManager<P>

§

impl<P> Unpin for HeapMemoryManager<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for HeapMemoryManager<P>

§

impl<P> UnwindSafe for HeapMemoryManager<P>
where P: UnwindSafe,

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.