nop externals

This commit is contained in:
Sergey Pepyakin 2018-01-09 18:18:16 +03:00
parent 0db8f109b3
commit f773c61cb1
2 changed files with 4 additions and 4 deletions

View File

@ -44,15 +44,15 @@ pub trait Externals {
fn check_signature(&self, index: HostFuncIndex, signature: &FunctionType) -> bool;
}
pub struct EmptyExternals;
pub struct NopExternals;
impl Externals for EmptyExternals {
impl Externals for NopExternals {
fn invoke_index(
&mut self,
_index: HostFuncIndex,
_args: &[RuntimeValue],
) -> Result<Option<RuntimeValue>, Error> {
Err(Error::Trap("invoke index on empty externals".into()))
Err(Error::Trap("invoke index on no-op externals".into()))
}
fn check_signature(&self, _index: HostFuncIndex, _signature: &FunctionType) -> bool {

View File

@ -123,7 +123,7 @@ pub use self::memory::{MemoryInstance, MemoryRef};
pub use self::table::{TableInstance, TableRef};
pub use self::program::ProgramInstance;
pub use self::value::{RuntimeValue, TryInto};
pub use self::host::{Externals, HostFuncIndex, EmptyExternals, HostError};
pub use self::host::{Externals, HostFuncIndex, NopExternals, HostError};
pub use self::imports::{ImportResolver, Imports};
pub use self::module::{ModuleInstance, ModuleRef, ExternVal};
pub use self::global::{GlobalInstance, GlobalRef};