MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / MemValue

Interface MemValue

crates/tinywasm/src/store/memory/mod.rs:375–383  ·  view source on GitHub ↗

A trait for types that can be converted to and from static byte arrays

Source from the content-addressed store, hash-verified

373
374/// A trait for types that can be converted to and from static byte arrays
375pub(crate) trait MemValue<const N: usize>: Copy + Default {
376 /// Store a value in memory
377 fn to_mem_bytes(self) -> [u8; N];
378
379 /// Load a value from memory
380 fn from_mem_bytes(bytes: [u8; N]) -> Self;
381
382 fn load(mem: &dyn LinearMemory, base: u64, offset: u64) -> core::result::Result<Self, crate::Trap>;
383}
384
385macro_rules! impl_mem_traits {
386 ($($ty:ty, $size:expr, $read:ident),* $(,)?) => {

Callers

nothing calls this directly

Implementers 1

mod.rscrates/tinywasm/src/store/memory/mod.r

Calls

no outgoing calls

Tested by

no test coverage detected