Skip to content

Commit

Permalink
doc(host) Fix the Externals example (#149)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Hywan authored and pepyakin committed Nov 28, 2018
1 parent c7f9196 commit da558c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
/// ))
/// }
/// }
Expand Down

0 comments on commit da558c7

Please sign in to comment.