From 681945908213a61ff137f5b607a9fa25b49ad6b9 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 22 Oct 2021 12:00:56 -0700 Subject: [PATCH] fix all docs links --- crates/wasmtime/src/externals.rs | 30 +++++++++++++++++++----------- crates/wasmtime/src/limits.rs | 7 ++++--- crates/wasmtime/src/memory.rs | 26 ++++++++++++++++---------- crates/wasmtime/src/store.rs | 26 ++++++++++++++++---------- 4 files changed, 55 insertions(+), 34 deletions(-) diff --git a/crates/wasmtime/src/externals.rs b/crates/wasmtime/src/externals.rs index d75b11c6c7..a35216eb09 100644 --- a/crates/wasmtime/src/externals.rs +++ b/crates/wasmtime/src/externals.rs @@ -408,9 +408,11 @@ impl Table { /// /// # Panics /// - /// This function will panic when used with a [`Store`] which has a - /// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When - /// using an async resource limiter, use [`Table::new_async`] instead. + /// This function will panic when used with a [`Store`](`crate::Store`) + /// which has a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) + /// (see also: [`Store::limiter_async`](`crate::Store::limiter_async`). + /// When using an async resource limiter, use [`Table::new_async`] + /// instead. /// /// # Examples /// @@ -442,12 +444,14 @@ impl Table { Table::_new(store.as_context_mut().0, ty, init) } - /// Async variant of [`Table::new`]. You must use this variant with [`Store`]s which have a - /// [`ResourceLimiterAsync`]. + /// Async variant of [`Table::new`]. You must use this variant with + /// [`Store`](`crate::Store`)s which have a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// /// # Panics /// - /// This function will panic when used with a non-async [`Store`]. + /// This function will panic when used with a non-async + /// [`Store`](`crate::Store`) #[cfg(feature = "async")] pub async fn new_async( mut store: impl AsContextMut, @@ -577,9 +581,11 @@ impl Table { /// /// Panics if `store` does not own this table. /// - /// This function will panic when used with a [`Store`] which has a - /// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When - /// using an async resource limiter, use [`Table::grow_async`] instead. + /// This function will panic when used with a [`Store`](`crate::Store`) + /// which has a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) + /// (see also: [`Store::limiter_async`](`crate::Store::limiter_async`)). + /// When using an async resource limiter, use [`Table::grow_async`] + /// instead. pub fn grow(&self, mut store: impl AsContextMut, delta: u32, init: Val) -> Result { let store = store.as_context_mut().0; let ty = self.ty(&store).element().clone(); @@ -597,11 +603,13 @@ impl Table { } } - /// Async variant of [`Table::grow`]. Required when using a [`ResourceLimiterAsync`]. + /// Async variant of [`Table::grow`]. Required when using a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// /// # Panics /// - /// This function will panic when used with a non-async [`Store`]. + /// This function will panic when used with a non-async + /// [`Store`](`crate::Store`). #[cfg(feature = "async")] pub async fn grow_async( &self, diff --git a/crates/wasmtime/src/limits.rs b/crates/wasmtime/src/limits.rs index 7ca9cb07f1..687f01371c 100644 --- a/crates/wasmtime/src/limits.rs +++ b/crates/wasmtime/src/limits.rs @@ -88,10 +88,11 @@ pub trait ResourceLimiter { #[cfg(feature = "async")] /// Used by hosts to limit resource consumption of instances. Identical to /// [`ResourceLimiter`], except that the `memory_growing` and `table_growing` -/// functions are async. Must be used with an async [`Store`]. +/// functions are async. Must be used with an async [`Store`](`crate::Store`). /// -/// This trait is used with [`Store::limiter_async`]: see those docs for -/// restrictions on using other Wasmtime interfaces with an async resource +/// This trait is used with +/// [`Store::limiter_async`](`crate::Store::limiter_async`)`: see those docs +/// for restrictions on using other Wasmtime interfaces with an async resource /// limiter. #[async_trait::async_trait] pub trait ResourceLimiterAsync { diff --git a/crates/wasmtime/src/memory.rs b/crates/wasmtime/src/memory.rs index b01fa366b8..9165807cd7 100644 --- a/crates/wasmtime/src/memory.rs +++ b/crates/wasmtime/src/memory.rs @@ -204,8 +204,9 @@ impl Memory { /// /// # Panics /// - /// This function will panic if the [`Store`] has a - /// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When + /// This function will panic if the [`Store`](`crate::Store`) has a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) (see also: + /// [`Store::limiter_async`](`crate::Store::limiter_async`)). When /// using an async resource limiter, use [`Memory::new_async`] instead. /// /// # Examples @@ -229,12 +230,14 @@ impl Memory { Memory::_new(store.as_context_mut().0, ty) } - /// Async variant of [`Memory::new`]. You must use this variant with [`Store`]s which have a - /// [`ResourceLimiterAsync`]. + /// Async variant of [`Memory::new`]. You must use this variant with + /// [`Store`](`crate::Store`)s which have a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// /// # Panics /// - /// This function will panic when used with a non-async [`Store`]. + /// This function will panic when used with a non-async + /// [`Store`](`crate::Store`). #[cfg(feature = "async")] pub async fn new_async( mut store: impl AsContextMut, @@ -465,9 +468,10 @@ impl Memory { /// /// Panics if this memory doesn't belong to `store`. /// - /// This function will panic if the [`Store`] has a - /// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When - /// using an async resource limiter, use [`Memory::grow_async`] instead. + /// This function will panic if the [`Store`](`crate::Store`) has a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) (see also: + /// [`Store::limiter_async`](`crate::Store::limiter_async`). When using an + /// async resource limiter, use [`Memory::grow_async`] instead. /// /// # Examples /// @@ -504,11 +508,13 @@ impl Memory { } } - /// Async variant of [`Memory::grow`]. Required when using a [`ResourceLimiterAsync`]. + /// Async variant of [`Memory::grow`]. Required when using a + /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`). /// /// # Panics /// - /// This function will panic when used with a non-async [`Store`]. + /// This function will panic when used with a non-async + /// [`Store`](`crate::Store`). #[cfg(feature = "async")] pub async fn grow_async( &self, diff --git a/crates/wasmtime/src/store.rs b/crates/wasmtime/src/store.rs index 44ae7fe3f9..6c3c85ccc9 100644 --- a/crates/wasmtime/src/store.rs +++ b/crates/wasmtime/src/store.rs @@ -541,16 +541,22 @@ impl Store { /// resources in the future, this does not retroactively attempt to apply /// limits to the [`Store`]. /// - /// This variation on the [`ResourceLimiter`] makes the `memory_growing` - /// and `table_growing` functions `async`. This means that, as part of - /// your resource limiting strategy, the async resource limiter may yield - /// execution until a resource becomes available. - /// - /// By using a [`ResourceLimiterAsync`] with a [`Store`], you can no - /// longer use [`Memory::new`], [`Memory::grow`], [`Table::new`], and - /// [`Table::grow`]. Instead, you must use their `async` variants: - /// [`Memory::new_async`], [`Memory::grow_async`], [`Table::new_async`], - /// and [`Table::grow_async`]. + /// This variation on the [`ResourceLimiter`](`crate::ResourceLimiter`) + /// makes the `memory_growing` and `table_growing` functions `async`. This + /// means that, as part of your resource limiting strategy, the async + /// resource limiter may yield execution until a resource becomes + /// available. + /// + /// By using a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) + /// with a [`Store`], you can no longer use + /// [`Memory::new`](`crate::Memory::new`), + /// [`Memory::grow`](`crate::Memory::grow`), + /// [`Table::new`](`crate::Table::new`), and + /// [`Table::grow`](`crate::Table::grow`). Instead, you must use their + /// `async` variants: [`Memory::new_async`](`crate::Memory::new_async`), + /// [`Memory::grow_async`](`crate::Memory::grow_async`), + /// [`Table::new_async`](`crate::Table::new_async`), and + /// [`Table::grow_async`](`crate::Table::grow_async`). #[cfg(feature = "async")] pub fn limiter_async( &mut self,