pub fn inspect_memory<'instance>(
    instance: &'instance Instance,
    memory_name: &str,
    start: usize,
    len: usize,
) -> Result<&'instance [u8], ActionError> {
    let definition = match unsafe { instance.lookup_immutable(memory_name) } {
        Some(Export::Memory {
            definition,
            memory: _memory,
            vmctx: _vmctx,
        }) => definition,
        Some(_) => {
            return Err(ActionError::Kind(format!(
                "exported item \"{}\" is not a linear memory",
                memory_name
            )))
        }
        None => {
            return Err(ActionError::Field(format!(
                "no export named \"{}\"",
                memory_name
            )))
        }
    };

    Ok(unsafe {
        let memory_def = &*definition;
        &slice::from_raw_parts(memory_def.base, memory_def.current_length)[start..start + len]
    })
}
/// Returns a slice of the contents of allocated linear memory.
Returns a slice of the contents of allocated linear memory.
Returns a slice of the contents of allocated linear memory .
pub fn inspect_memory<'instance>(
    instance: &'instance Instance,
    memory_name: &str,
    start: usize,
    len: usize,
) -> Result<&'instance [u8], ActionError> {
    let definition = match unsafe { instance.lookup_immutable(memory_name) } {
        Some(Export::Memory {
            definition,
            memory: _memory,
            vmctx: _vmctx,
        }) => definition,
        Some(_) => {
            return Err(ActionError::Kind(format!(
                "exported item \"{}\" is not a linear memory",
                memory_name
            )))
        }
        None => {
            return Err(ActionError::Field(format!(
                "no export named \"{}\"",
                memory_name
            )))
        }
    };
    Ok(unsafe {
        let memory_def = &*definition;
        &slice::from_raw_parts(memory_def.base, memory_def.current_length)[start..start + len]
    })
}
pub fn inspect_memory < ' instance > ( instance : & ' instance Instance , memory_name : & str , start : usize , len : usize , ) -> Result < & ' instance [ u8 ] , ActionError > { let definition = match unsafe { instance . lookup_immutable ( memory_name ) } { Some ( Export :: Memory { definition , memory : _memory , vmctx : _vmctx , } ) => definition , Some ( _ ) => { return Err ( ActionError :: Kind ( format ! ( " \" \" " memory_name ) ) ) } None => { return Err ( ActionError :: Field ( format ! ( " \" \" " memory_name ) ) ) } } ; Ok ( unsafe { let memory_def = & * definition ; & slice :: from_raw_parts ( memory_def . base , memory_def . current_length ) [ start .. start + len ] } ) }
Returns a slice of the contents of allocated linear memory.
Returns a slice of the contents of allocated linear memory .
instance
&'instance Instance
memory_name
&str
start
usize
len
usize