From 281c02d39d2b555bbb290719360b2b7f169c14b5 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 23 Nov 2018 16:54:06 +0100 Subject: [PATCH] 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. --- src/host.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/host.rs b/src/host.rs index 745f207..e0d4092 100644 --- a/src/host.rs +++ b/src/host.rs @@ -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, /// )) /// } /// }