pub struct MemoryView { /* private fields */ }Expand description
Zero-copy memory view for WASM state inspection
Per spec: “Eliminates bincode serialization per-frame (Muda)”
§Safety
The memory view is only valid while the WASM instance is alive. Do not store references across frame boundaries.
Implementations§
Source§impl MemoryView
impl MemoryView
Sourcepub fn with_entity_table(self, offset: usize, count: usize) -> Self
pub fn with_entity_table(self, offset: usize, count: usize) -> Self
Configure entity table location
Sourcepub fn with_component_arrays(self, offset: usize) -> Self
pub fn with_component_arrays(self, offset: usize) -> Self
Configure component arrays location
Sourcepub const fn entity_count(&self) -> usize
pub const fn entity_count(&self) -> usize
Get entity count
Sourcepub const fn entity_table_offset(&self) -> usize
pub const fn entity_table_offset(&self) -> usize
Get entity table offset
Sourcepub const fn component_arrays_offset(&self) -> usize
pub const fn component_arrays_offset(&self) -> usize
Get component arrays offset
Sourcepub unsafe fn read_at<T: Copy>(
&self,
memory: &[u8],
offset: usize,
) -> ProbarResult<T>
pub unsafe fn read_at<T: Copy>( &self, memory: &[u8], offset: usize, ) -> ProbarResult<T>
Read a value at the given offset from a memory slice
§Safety
Caller must ensure:
offset + size_of::<T>() <= memory.len()- The memory at offset contains a valid T
Sourcepub fn read_slice<'a>(
&self,
memory: &'a [u8],
offset: usize,
len: usize,
) -> ProbarResult<&'a [u8]>
pub fn read_slice<'a>( &self, memory: &'a [u8], offset: usize, len: usize, ) -> ProbarResult<&'a [u8]>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryView
impl RefUnwindSafe for MemoryView
impl Send for MemoryView
impl Sync for MemoryView
impl Unpin for MemoryView
impl UnsafeUnpin for MemoryView
impl UnwindSafe for MemoryView
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