pub struct MemoryLayout {
pub slot_count: usize,
pub arena_bytes: usize,
pub event_arena_bytes: usize,
}Expand description
The fixed layout of the shared linear memory.
Fields§
§slot_count: usizeRing capacity in slots (must be a power of two).
arena_bytes: usizeGuest arena capacity in bytes.
event_arena_bytes: usizeHost → guest (event) arena capacity in bytes.
Implementations§
Source§impl MemoryLayout
impl MemoryLayout
Sourcepub fn ring_bytes(&self) -> usize
pub fn ring_bytes(&self) -> usize
Ring region byte length.
Sourcepub fn event_ring_bytes(&self) -> usize
pub fn event_ring_bytes(&self) -> usize
Event (host → guest) ring region byte length. Reuses slot_count so
both rings share the same capacity (power of two).
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total linear memory size: header + ring + event ring + arena + event arena.
Sourcepub fn ring_offset(&self) -> usize
pub fn ring_offset(&self) -> usize
Byte offset of the ring region (directly after the header).
Sourcepub fn event_ring_offset(&self) -> usize
pub fn event_ring_offset(&self) -> usize
Byte offset of the host → guest event ring region (after the main ring).
Sourcepub fn arena_offset(&self) -> usize
pub fn arena_offset(&self) -> usize
Byte offset of the guest arena region (directly after the event ring).
Sourcepub fn event_arena_offset(&self) -> usize
pub fn event_arena_offset(&self) -> usize
Byte offset of the host → guest (event) arena region (after the guest arena). Owned by the host: it bump-allocates event string payloads here.
Trait Implementations§
Source§impl Clone for MemoryLayout
impl Clone for MemoryLayout
impl Copy for MemoryLayout
Source§impl Debug for MemoryLayout
impl Debug for MemoryLayout
Source§impl Default for MemoryLayout
impl Default for MemoryLayout
impl Eq for MemoryLayout
Source§impl PartialEq for MemoryLayout
impl PartialEq for MemoryLayout
impl StructuralPartialEq for MemoryLayout
Auto Trait Implementations§
impl Forget for MemoryLayout
impl Freeze for MemoryLayout
impl Move for MemoryLayout
impl RefUnwindSafe for MemoryLayout
impl Send for MemoryLayout
impl Sync for MemoryLayout
impl Unpin for MemoryLayout
impl UnsafeUnpin for MemoryLayout
impl UnwindSafe for MemoryLayout
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