doc(host) Fix the `Externals` example (#149)

* doc(host) Fix the `Externals` example

The example is missing two things:

  * `index` is computed but not used,
  * `check_signature` is never used.

This patch tries to fix that.

* doc(host) Fix `check_signature` example
This commit is contained in:
Ivan Enderlin 2018-11-28 14:03:03 +01:00 committed by Sergey Pepyakin
parent c7f9196df6
commit da558c7ce7
1 changed files with 8 additions and 2 deletions

View File

@ -189,10 +189,16 @@ impl HostError {
/// ))
/// }
/// };
///
///
/// if !self.check_signature(index, signature) {
/// return Err(Error::Instantiation(
/// format!("Export {} has a bad signature", field_name)
/// ));
/// }
///
/// Ok(FuncInstance::alloc_host(
/// Signature::new(&[ValueType::I32, ValueType::I32][..], Some(ValueType::I32)),
/// ADD_FUNC_INDEX,
/// index,
/// ))
/// }
/// }