From da558c7ce71e8ede73f996a9e71f94a433baf1a8 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 28 Nov 2018 14:03:03 +0100 Subject: [PATCH] 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 --- src/host.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/host.rs b/src/host.rs index 745f207..998f16f 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, /// )) /// } /// }