pub fn call_in_wasm_module<E: Externalities<Blake2Hasher>>(
		&self,
		ext: &mut E,
		module_instance: &ModuleRef,
		method: &str,
		data: &[u8],
	) -> Result<Vec<u8>> {
		self.call_in_wasm_module_with_custom_signature(
			ext,
			module_instance,
			method,
			|alloc| {
				let offset = alloc(data)?;
				Ok(vec![I32(offset as i32), I32(data.len() as i32)])
			},
			|res, memory| {
				if let Some(I64(r)) = res {
					let offset = r as u32;
					let length = (r as u64 >> 32) as usize;
					memory.get(offset, length).map_err(|_| ErrorKind::Runtime.into()).map(Some)
				} else {
					Ok(None)
				}
			}
		)
	}
/// Call a given method in the given wasm-module runtime.
Call a given method in the given wasm-module runtime.
Call a given method in the given wasm - module runtime .
pub fn call_in_wasm_module<E: Externalities<Blake2Hasher>>(
		&self,
		ext: &mut E,
		module_instance: &ModuleRef,
		method: &str,
		data: &[u8],
	) -> Result<Vec<u8>> {
		self.call_in_wasm_module_with_custom_signature(
			ext,
			module_instance,
			method,
			|alloc| {
				let offset = alloc(data)?;
				Ok(vec![I32(offset as i32), I32(data.len() as i32)])
			},
			|res, memory| {
				if let Some(I64(r)) = res {
					let offset = r as u32;
					let length = (r as u64 >> 32) as usize;
					memory.get(offset, length).map_err(|_| ErrorKind::Runtime.into()).map(Some)
				} else {
					Ok(None)
				}
			}
		)
	}
pub fn call_in_wasm_module < E : Externalities < Blake2Hasher > > ( & self , ext : & mut E , module_instance : & ModuleRef , method : & str , data : & [ u8 ] , ) -> Result < Vec < u8 > > { self . call_in_wasm_module_with_custom_signature ( ext , module_instance , method , | alloc | { let offset = alloc ( data ) ? ; Ok ( vec ! [ I32 ( offset as i32 ) I32 ( data len ( ) as i32 ) ] ) } , | res , memory | { if let Some ( I64 ( r ) ) = res { let offset = r as u32 ; let length = ( r as u64 >> 32 ) as usize ; memory . get ( offset , length ) . map_err ( | _ | ErrorKind :: Runtime . into ( ) ) . map ( Some ) } else { Ok ( None ) } } ) }
Call a given method in the given wasm-module runtime.
Call a given method in the given wasm - module runtime .
&self
ext
&mut E
module_instance
&ModuleRef
method
&str
data
&[u8]
&self
ext
&mut E
module_instance
&ModuleRef
method
&str
data
&[u8]