From 354bdd8cf56fb2d336754fffc64b7fa0c94a1820 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 29 Apr 2020 13:33:28 -0700 Subject: [PATCH 1/3] Fix errors in run of `cargo doc`. --- lib/api/src/exports.rs | 12 ++++++++++-- lib/api/src/instance.rs | 4 +++- lib/api/src/ptr.rs | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/api/src/exports.rs b/lib/api/src/exports.rs index 6ab7cb85f35..943078afe7d 100644 --- a/lib/api/src/exports.rs +++ b/lib/api/src/exports.rs @@ -9,6 +9,8 @@ use wasmer_runtime::Export; /// The `ExportError` can happen when trying to get a specific /// export [`Extern`] from the [`Instance`] exports. /// +/// [`Instance`]: wasmer_runtime::instance::Instance +/// /// ```ignore /// # let my_instance = Instance::new(...); /// @@ -146,12 +148,18 @@ impl LikeNamespace for Exports { } /// This trait is used to mark types as gettable from an [`Instance`]. +/// +/// [`Instance`]: wasmer_runtime::instance::Instance pub trait Exportable<'a>: Sized { - /// This function is used when providedd the Extern as exportable, so it - /// can be used while instantiating the Module. + /// This function is used when providedd the [`Extern`] as exportable, so it + /// can be used while instantiating the [`Module`]. + /// + /// [`Module`]: wasmer_runtime::Module fn to_export(&self) -> Export; /// Implementation of how to get the export corresponding to the implementing type /// from an [`Instance`] by name. + /// + /// [`Instance`]: wasmer_runtime::instance::Instance fn get_self_from_extern(_extern: &'a Extern) -> Result<&'a Self, ExportError>; } diff --git a/lib/api/src/instance.rs b/lib/api/src/instance.rs index d5dea9b1834..464f5008b0c 100644 --- a/lib/api/src/instance.rs +++ b/lib/api/src/instance.rs @@ -29,6 +29,8 @@ impl Instance { /// /// The [`ImportObject`] is the easiest way to provide imports to the instance. /// + /// [`ImportObject`]: crate::ImportObject + /// /// ``` /// # use wasmer::{imports, Store, Module, Global, Instance}; /// let store = Store::default(); @@ -43,7 +45,7 @@ impl Instance { /// /// ## Errors /// - /// The function can return [`InstantiationErrors`]. + /// The function can return [`InstantiationError`]s. /// /// Those are, as defined by the spec: /// * Link errors that happen when plugging the imports into the instance diff --git a/lib/api/src/ptr.rs b/lib/api/src/ptr.rs index f3344f16ab2..fe4f5f75a46 100644 --- a/lib/api/src/ptr.rs +++ b/lib/api/src/ptr.rs @@ -205,7 +205,7 @@ impl WasmPtr { /// Get a UTF-8 string from the `WasmPtr`, where the string is nul-terminated. /// /// Note that this does not account for UTF-8 strings that _contain_ nul themselves, - /// [`get_utf8_string`] has to be used for those. + /// [`WasmPtr::get_utf8_string`] has to be used for those. /// /// Also note that this method returns a reference to Wasm linear memory. The /// underlying data can be mutated if the Wasm is allowed to execute or From 150a430026b925d9ef94120606a690888df77f53 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 29 Apr 2020 14:14:19 -0700 Subject: [PATCH 2/3] Use `crate::Instance`. --- lib/api/src/exports.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/api/src/exports.rs b/lib/api/src/exports.rs index 943078afe7d..d1eda6f3d4e 100644 --- a/lib/api/src/exports.rs +++ b/lib/api/src/exports.rs @@ -9,7 +9,7 @@ use wasmer_runtime::Export; /// The `ExportError` can happen when trying to get a specific /// export [`Extern`] from the [`Instance`] exports. /// -/// [`Instance`]: wasmer_runtime::instance::Instance +/// [`Instance`]: crate::Instance /// /// ```ignore /// # let my_instance = Instance::new(...); @@ -149,7 +149,7 @@ impl LikeNamespace for Exports { /// This trait is used to mark types as gettable from an [`Instance`]. /// -/// [`Instance`]: wasmer_runtime::instance::Instance +/// [`Instance`]: crate::Instance pub trait Exportable<'a>: Sized { /// This function is used when providedd the [`Extern`] as exportable, so it /// can be used while instantiating the [`Module`]. @@ -160,6 +160,6 @@ pub trait Exportable<'a>: Sized { /// Implementation of how to get the export corresponding to the implementing type /// from an [`Instance`] by name. /// - /// [`Instance`]: wasmer_runtime::instance::Instance + /// [`Instance`]: crate::Instance fn get_self_from_extern(_extern: &'a Extern) -> Result<&'a Self, ExportError>; } From 61aee6cc928586d29f84742cf65e4d37091b744f Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 29 Apr 2020 14:16:41 -0700 Subject: [PATCH 3/3] Also use crate for Module. --- lib/api/src/exports.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/src/exports.rs b/lib/api/src/exports.rs index d1eda6f3d4e..03b79fc823e 100644 --- a/lib/api/src/exports.rs +++ b/lib/api/src/exports.rs @@ -154,7 +154,7 @@ pub trait Exportable<'a>: Sized { /// This function is used when providedd the [`Extern`] as exportable, so it /// can be used while instantiating the [`Module`]. /// - /// [`Module`]: wasmer_runtime::Module + /// [`Module`]: crate::Module fn to_export(&self) -> Export; /// Implementation of how to get the export corresponding to the implementing type