pub fn memory(&self, mem_index: u32) -> &Memory {
        let module = unsafe { &*self.module };
        let mem_index = MemoryIndex::new(mem_index as usize);
        match mem_index.local_or_import(&module.info) {
            LocalOrImport::Local(local_mem_index) => unsafe {
                let local_backing = &*self.local_backing;
                &local_backing.memories[local_mem_index]
            },
            LocalOrImport::Import(import_mem_index) => unsafe {
                let import_backing = &*self.import_backing;
                &import_backing.memories[import_mem_index]
            },
        }
    }
/// This exposes the specified memory of the WebAssembly instance
/// as a immutable slice.
///
/// WebAssembly will soon support multiple linear memories, so this
/// forces the user to specify.
///
/// # Usage:
///
/// ```
/// # use wasmer_runtime_core::{
/// #     vm::Ctx,
/// # };
/// fn read_memory(ctx: &Ctx) -> u8 {
///     let first_memory = ctx.memory(0);
///     // Read the first byte of that linear memory.
///     first_memory.view()[0].get()
/// }
/// ```
This exposes the specified memory of the WebAssembly instance
as a immutable slice.

WebAssembly will soon support multiple linear memories, so this
forces the user to specify.
This exposes the specified memory of the WebAssembly instance as a immutable slice . WebAssembly will soon support multiple linear memories so this forces the user to specify .
pub fn memory(&self, mem_index: u32) -> &Memory {
        let module = unsafe { &*self.module };
        let mem_index = MemoryIndex::new(mem_index as usize);
        match mem_index.local_or_import(&module.info) {
            LocalOrImport::Local(local_mem_index) => unsafe {
                let local_backing = &*self.local_backing;
                &local_backing.memories[local_mem_index]
            },
            LocalOrImport::Import(import_mem_index) => unsafe {
                let import_backing = &*self.import_backing;
                &import_backing.memories[import_mem_index]
            },
        }
    }
pub fn memory ( & self , mem_index : u32 ) -> & Memory { let module = unsafe { & * self . module } ; let mem_index = MemoryIndex :: new ( mem_index as usize ) ; match mem_index . local_or_import ( & module . info ) { LocalOrImport :: Local ( local_mem_index ) => unsafe { let local_backing = & * self . local_backing ; & local_backing . memories [ local_mem_index ] } , LocalOrImport :: Import ( import_mem_index ) => unsafe { let import_backing = & * self . import_backing ; & import_backing . memories [ import_mem_index ] } , } }
This exposes the specified memory of the WebAssembly instance
as a immutable slice.
This exposes the specified memory of the WebAssembly instance as a immutable slice .
&self
mem_index
u32
&self
mem_index
u32
usage:
None
use wasmer_runtime_core::{
None
vm::ctx,
None
};
fn read_memory(ctx: &Ctx) -> u8 {
let first_memory = ctx.memory(0);
Read the first byte of that linear memory.
fn read_memory ( ctx : &Ctx ) - > u8 { let first_memory = ctx . memory ( 0 ) ; Read the first byte of that linear memory .