pub struct HeapMemoryManager<P: Payload> { /* private fields */ }Expand description
A heap-backed fixed-capacity memory manager.
Implementations§
Source§impl<P: Payload> HeapMemoryManager<P>
impl<P: Payload> HeapMemoryManager<P>
Sourcepub fn new(capacity: usize) -> Self
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.
Sourcepub fn with_memory_class(capacity: usize, mem_class: MemoryClass) -> Self
pub fn with_memory_class(capacity: usize, mem_class: MemoryClass) -> Self
Create a new manager with given capacity and explicit memory_class.
Sourcepub fn configured_capacity(&self) -> usize
pub fn configured_capacity(&self) -> usize
Return the configured capacity.
Trait Implementations§
Source§impl<P: Payload> HeaderStore for HeapMemoryManager<P>
impl<P: Payload> HeaderStore for HeapMemoryManager<P>
Source§type HeaderGuard<'a> = HeapHeaderGuard<'a>
where
Self: 'a
type HeaderGuard<'a> = HeapHeaderGuard<'a> where Self: 'a
Guard type returned by
HeaderStore::peek_header. Read moreSource§fn peek_header(
&self,
token: MessageToken,
) -> Result<Self::HeaderGuard<'_>, MemoryError>
fn peek_header( &self, token: MessageToken, ) -> Result<Self::HeaderGuard<'_>, MemoryError>
Borrow the header of the message identified by
token. Read moreSource§impl<P: Payload> MemoryManager<P> for HeapMemoryManager<P>
impl<P: Payload> MemoryManager<P> for HeapMemoryManager<P>
Source§type ReadGuard<'a> = HeapReadGuard<'a, P>
where
Self: 'a
type ReadGuard<'a> = HeapReadGuard<'a, P> where Self: 'a
Shared read guard returned by
MemoryManager::read. Read moreSource§type WriteGuard<'a> = HeapWriteGuard<'a, P>
where
Self: 'a
type WriteGuard<'a> = HeapWriteGuard<'a, P> where Self: 'a
Exclusive mutable guard returned by
MemoryManager::read_mut. Read moreSource§fn store(&mut self, value: Message<P>) -> Result<MessageToken, MemoryError>
fn store(&mut self, value: Message<P>) -> Result<MessageToken, MemoryError>
Allocate storage for
value and return its token. Read moreSource§fn read(&self, token: MessageToken) -> Result<Self::ReadGuard<'_>, MemoryError>
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>
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>
fn free(&mut self, token: MessageToken) -> Result<(), MemoryError>
Free the slot identified by
token. Read moreSource§fn memory_class(&self) -> MemoryClass
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> 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