pub(super) fn stable_write(
        &mut self,
        offset: u32,
        src: u32,
        size: u32,
        heap: &[u8],
    ) -> HypervisorResult<()> {
        let (src, offset, size) = (src as usize, offset as usize, size as usize);

        if offset + size > (self.stable_size()? as usize * WASM_PAGE_SIZE_IN_BYTES as usize) {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }

        if src + size > heap.len() {
            return Err(HypervisorError::Trapped(HeapOutOfBounds));
        }

        self.stable_memory_buffer
            .write(&heap[src..src + size], offset);
        Ok(())
    }
/// Writes from heap to stable memory.
Writes from heap to stable memory.
Writes from heap to stable memory .
pub(super) fn stable_write(
        &mut self,
        offset: u32,
        src: u32,
        size: u32,
        heap: &[u8],
    ) -> HypervisorResult<()> {
        let (src, offset, size) = (src as usize, offset as usize, size as usize);
        if offset + size > (self.stable_size()? as usize * WASM_PAGE_SIZE_IN_BYTES as usize) {
            return Err(HypervisorError::Trapped(StableMemoryOutOfBounds));
        }
        if src + size > heap.len() {
            return Err(HypervisorError::Trapped(HeapOutOfBounds));
        }
        self.stable_memory_buffer
            .write(&heap[src..src + size], offset);
        Ok(())
    }
pub ( super ) fn stable_write ( & mut self , offset : u32 , src : u32 , size : u32 , heap : & [ u8 ] , ) -> HypervisorResult < ( ) > { let ( src , offset , size ) = ( src as usize , offset as usize , size as usize ) ; if offset + size > ( self . stable_size ( ) ? as usize * WASM_PAGE_SIZE_IN_BYTES as usize ) { return Err ( HypervisorError :: Trapped ( StableMemoryOutOfBounds ) ) ; } if src + size > heap . len ( ) { return Err ( HypervisorError :: Trapped ( HeapOutOfBounds ) ) ; } self . stable_memory_buffer . write ( & heap [ src .. src + size ] , offset ) ; Ok ( ( ) ) }
Writes from heap to stable memory.
Writes from heap to stable memory .
&mut self
offset
u32
src
u32
size
u32
heap
&[u8]
&mut self
offset
u32
src
u32
size
u32
heap
&[u8]