pub struct LazyLinearMemory { /* private fields */ }Expand description
A linear memory wrapper that materializes its inner backend on first access.
If the wrapped backend fails to create the inner memory during first access, this wrapper will panic.
Implementations§
Source§impl LazyLinearMemory
impl LazyLinearMemory
Sourcepub fn try_new(ty: MemoryType, backend: MemoryBackend) -> Result<Self>
pub fn try_new(ty: MemoryType, backend: MemoryBackend) -> Result<Self>
Creates a lazy memory for ty using backend for the eventual materialized storage.
Trait Implementations§
Source§impl Debug for LazyLinearMemory
Available on crate feature debug only.
impl Debug for LazyLinearMemory
Available on crate feature
debug only.Source§impl LinearMemory for LazyLinearMemory
impl LinearMemory for LazyLinearMemory
Source§fn grow_to(&mut self, new_len: usize) -> Result<(), Trap>
fn grow_to(&mut self, new_len: usize) -> Result<(), Trap>
Grows the memory to
new_len bytes. Read moreSource§fn write_all(&mut self, addr: usize, src: &[u8]) -> Option<()>
fn write_all(&mut self, addr: usize, src: &[u8]) -> Option<()>
Writes all bytes in
src starting at addr, or returns None if any byte could not be written.Source§fn fill(&mut self, addr: usize, len: usize, val: u8) -> Option<()>
fn fill(&mut self, addr: usize, len: usize, val: u8) -> Option<()>
Fills the range
[addr, addr + len) with val.Source§fn copy_within(&mut self, dst: usize, src: usize, len: usize) -> Option<()>
fn copy_within(&mut self, dst: usize, src: usize, len: usize) -> Option<()>
Copies
len bytes from src to dst within the same memory.Source§fn read_exact(&self, addr: usize, dst: &mut [u8]) -> Option<()>
fn read_exact(&self, addr: usize, dst: &mut [u8]) -> Option<()>
Reads exactly
dst.len() bytes starting at addr.Source§fn read_vec(&self, addr: usize, len: usize) -> Option<Vec<u8>>
fn read_vec(&self, addr: usize, len: usize) -> Option<Vec<u8>>
Reads
len bytes starting at addr into a newly allocated buffer.Source§fn read_8(&self, base: u64, offset: u64) -> Result<u8, Trap>
fn read_8(&self, base: u64, offset: u64) -> Result<u8, Trap>
Reads exactly 1 byte at the effective address
base + offset.Source§fn read_16(&self, base: u64, offset: u64) -> Result<[u8; 2], Trap>
fn read_16(&self, base: u64, offset: u64) -> Result<[u8; 2], Trap>
Reads exactly 2 bytes at the effective address
base + offset.Source§fn read_32(&self, base: u64, offset: u64) -> Result<[u8; 4], Trap>
fn read_32(&self, base: u64, offset: u64) -> Result<[u8; 4], Trap>
Reads exactly 4 bytes at the effective address
base + offset.Source§fn read_64(&self, base: u64, offset: u64) -> Result<[u8; 8], Trap>
fn read_64(&self, base: u64, offset: u64) -> Result<[u8; 8], Trap>
Reads exactly 8 bytes at the effective address
base + offset.Source§fn read_128(&self, base: u64, offset: u64) -> Result<[u8; 16], Trap>
fn read_128(&self, base: u64, offset: u64) -> Result<[u8; 16], Trap>
Reads exactly 16 bytes at the effective address
base + offset.Source§fn write_8(&mut self, base: u64, offset: u64, byte: u8) -> Result<(), Trap>
fn write_8(&mut self, base: u64, offset: u64, byte: u8) -> Result<(), Trap>
Writes exactly 1 byte at the effective address
base + offset.Source§fn write_16(
&mut self,
base: u64,
offset: u64,
bytes: [u8; 2],
) -> Result<(), Trap>
fn write_16( &mut self, base: u64, offset: u64, bytes: [u8; 2], ) -> Result<(), Trap>
Writes exactly 2 bytes at the effective address
base + offset.Source§fn write_32(
&mut self,
base: u64,
offset: u64,
bytes: [u8; 4],
) -> Result<(), Trap>
fn write_32( &mut self, base: u64, offset: u64, bytes: [u8; 4], ) -> Result<(), Trap>
Writes exactly 4 bytes at the effective address
base + offset.Source§fn write_64(
&mut self,
base: u64,
offset: u64,
bytes: [u8; 8],
) -> Result<(), Trap>
fn write_64( &mut self, base: u64, offset: u64, bytes: [u8; 8], ) -> Result<(), Trap>
Writes exactly 8 bytes at the effective address
base + offset.Auto Trait Implementations§
impl !Freeze for LazyLinearMemory
impl !RefUnwindSafe for LazyLinearMemory
impl !Send for LazyLinearMemory
impl !Sync for LazyLinearMemory
impl !UnwindSafe for LazyLinearMemory
impl Unpin for LazyLinearMemory
impl UnsafeUnpin for LazyLinearMemory
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