pub struct RuntimeMemory<M: Memory> { /* private fields */ }Expand description
RuntimeMemory
Cloneable virtual memory opened through a runtime’s committed authority.
Implements Memory for stable structures without exposing the backing
memory or an alternate manager. Cloning does not require M: Clone.
IO checks the virtual extent before upstream bucket translation. Empty IO
is valid at the end of memory, but not beyond it. Reads preserve the upstream
optimized support for uninitialized destinations through Memory::read_unsafe.
Growth reserves physical capacity before assigning manager buckets. Ordinary
backing refusal, arithmetic overflow and bucket exhaustion return typed errors
without changing virtual extents or manager metadata. Backing implementations
must obey the Memory contract; traps and partial writes are not transactions
on native memory. Typed collections retain their own failure behavior.
Implementations§
Source§impl<M: Memory> RuntimeMemory<M>
impl<M: Memory> RuntimeMemory<M>
Sourcepub fn grow(&self, pages: u64) -> Result<u64, RuntimeGrowError>
pub fn grow(&self, pages: u64) -> Result<u64, RuntimeGrowError>
Grow by the requested pages, returning the previous virtual page count.
Capacity is reserved before assigning manager buckets. Ordinary refusal
preserves virtual extents and manager metadata and permits retry. The
upstream Memory::grow adapter translates errors into its required
-1 sentinel; direct runtime callers receive super::RuntimeGrowError.
A zero-page request returns the current extent without backing IO or
manager mutation, after checking for reentrant growth.
§Panics
Panics if a private growth-accounting invariant is broken or backing memory panics.