mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-26 05:02:03 +00:00
added DummyError alias
This commit is contained in:
@ -100,6 +100,9 @@ pub use self::variable::{VariableInstance, VariableType, ExternalVariableValue};
|
||||
pub use self::env_native::{env_native_module, UserDefinedElements, UserFunctionExecutor, UserFunctionDescriptor};
|
||||
pub use self::env::EnvParams;
|
||||
|
||||
/// Default type of Error if you do not need any custom user errors.
|
||||
pub type DummyError = Error<DummyUserError>;
|
||||
|
||||
/// Default type of ProgramInstance if you do not need any custom user errors.
|
||||
/// To work with custom user errors or interpreter internals, use CustomProgramInstance.
|
||||
pub type DefaultProgramInstance = self::program::ProgramInstance<DummyUserError>;
|
||||
|
@ -3,7 +3,7 @@
|
||||
use std::sync::Arc;
|
||||
use builder::module;
|
||||
use elements::{ValueType, Opcodes, Opcode, BlockType, Local};
|
||||
use interpreter::{Error, DummyUserError, DefaultProgramInstance, DefaultModuleInstanceInterface, ModuleInstanceInterface, ItemIndex};
|
||||
use interpreter::{Error, DummyError, DefaultProgramInstance, DefaultModuleInstanceInterface, ModuleInstanceInterface, ItemIndex};
|
||||
use interpreter::value::{RuntimeValue, TryInto};
|
||||
|
||||
fn make_function_i32(body: Opcodes) -> (DefaultProgramInstance, Arc<DefaultModuleInstanceInterface>) {
|
||||
@ -22,7 +22,7 @@ fn make_function_i32(body: Opcodes) -> (DefaultProgramInstance, Arc<DefaultModul
|
||||
(program, module)
|
||||
}
|
||||
|
||||
fn run_function_i32(module: &Arc<DefaultModuleInstanceInterface>, arg: i32) -> Result<i32, Error<DummyUserError>> {
|
||||
fn run_function_i32(module: &Arc<DefaultModuleInstanceInterface>, arg: i32) -> Result<i32, DummyError> {
|
||||
module
|
||||
.execute_index(0, vec![RuntimeValue::I32(arg)].into())
|
||||
.and_then(|r| r.unwrap().try_into())
|
||||
|
Reference in New Issue
Block a user