fix all docs links

This commit is contained in:
Pat Hickey
2021-10-22 12:00:56 -07:00
parent 996289725d
commit 6819459082
4 changed files with 54 additions and 33 deletions

View File

@@ -408,9 +408,11 @@ impl Table {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic when used with a [`Store`] which has a /// This function will panic when used with a [`Store`](`crate::Store`)
/// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When /// which has a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`)
/// using an async resource limiter, use [`Table::new_async`] instead. /// (see also: [`Store::limiter_async`](`crate::Store::limiter_async`).
/// When using an async resource limiter, use [`Table::new_async`]
/// instead.
/// ///
/// # Examples /// # Examples
/// ///
@@ -442,12 +444,14 @@ impl Table {
Table::_new(store.as_context_mut().0, ty, init) 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 /// Async variant of [`Table::new`]. You must use this variant with
/// [`ResourceLimiterAsync`]. /// [`Store`](`crate::Store`)s which have a
/// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`).
/// ///
/// # Panics /// # 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")] #[cfg(feature = "async")]
pub async fn new_async<T>( pub async fn new_async<T>(
mut store: impl AsContextMut<Data = T>, mut store: impl AsContextMut<Data = T>,
@@ -577,9 +581,11 @@ impl Table {
/// ///
/// Panics if `store` does not own this table. /// Panics if `store` does not own this table.
/// ///
/// This function will panic when used with a [`Store`] which has a /// This function will panic when used with a [`Store`](`crate::Store`)
/// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When /// which has a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`)
/// using an async resource limiter, use [`Table::grow_async`] instead. /// (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<u32> { pub fn grow(&self, mut store: impl AsContextMut, delta: u32, init: Val) -> Result<u32> {
let store = store.as_context_mut().0; let store = store.as_context_mut().0;
let ty = self.ty(&store).element().clone(); 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 /// # 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")] #[cfg(feature = "async")]
pub async fn grow_async<T>( pub async fn grow_async<T>(
&self, &self,

View File

@@ -88,10 +88,11 @@ pub trait ResourceLimiter {
#[cfg(feature = "async")] #[cfg(feature = "async")]
/// Used by hosts to limit resource consumption of instances. Identical to /// Used by hosts to limit resource consumption of instances. Identical to
/// [`ResourceLimiter`], except that the `memory_growing` and `table_growing` /// [`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 /// This trait is used with
/// restrictions on using other Wasmtime interfaces with an async resource /// [`Store::limiter_async`](`crate::Store::limiter_async`)`: see those docs
/// for restrictions on using other Wasmtime interfaces with an async resource
/// limiter. /// limiter.
#[async_trait::async_trait] #[async_trait::async_trait]
pub trait ResourceLimiterAsync { pub trait ResourceLimiterAsync {

View File

@@ -204,8 +204,9 @@ impl Memory {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic if the [`Store`] has a /// This function will panic if the [`Store`](`crate::Store`) has a
/// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) (see also:
/// [`Store::limiter_async`](`crate::Store::limiter_async`)). When
/// using an async resource limiter, use [`Memory::new_async`] instead. /// using an async resource limiter, use [`Memory::new_async`] instead.
/// ///
/// # Examples /// # Examples
@@ -229,12 +230,14 @@ impl Memory {
Memory::_new(store.as_context_mut().0, ty) Memory::_new(store.as_context_mut().0, ty)
} }
/// Async variant of [`Memory::new`]. You must use this variant with [`Store`]s which have a /// Async variant of [`Memory::new`]. You must use this variant with
/// [`ResourceLimiterAsync`]. /// [`Store`](`crate::Store`)s which have a
/// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`).
/// ///
/// # Panics /// # 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")] #[cfg(feature = "async")]
pub async fn new_async<T>( pub async fn new_async<T>(
mut store: impl AsContextMut<Data = T>, mut store: impl AsContextMut<Data = T>,
@@ -465,9 +468,10 @@ impl Memory {
/// ///
/// Panics if this memory doesn't belong to `store`. /// Panics if this memory doesn't belong to `store`.
/// ///
/// This function will panic if the [`Store`] has a /// This function will panic if the [`Store`](`crate::Store`) has a
/// [`ResourceLimiterAsync`] (see also: [`Store::limiter_async`]). When /// [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`) (see also:
/// using an async resource limiter, use [`Memory::grow_async`] instead. /// [`Store::limiter_async`](`crate::Store::limiter_async`). When using an
/// async resource limiter, use [`Memory::grow_async`] instead.
/// ///
/// # Examples /// # 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 /// # 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")] #[cfg(feature = "async")]
pub async fn grow_async<T>( pub async fn grow_async<T>(
&self, &self,

View File

@@ -541,16 +541,22 @@ impl<T> Store<T> {
/// resources in the future, this does not retroactively attempt to apply /// resources in the future, this does not retroactively attempt to apply
/// limits to the [`Store`]. /// limits to the [`Store`].
/// ///
/// This variation on the [`ResourceLimiter`] makes the `memory_growing` /// This variation on the [`ResourceLimiter`](`crate::ResourceLimiter`)
/// and `table_growing` functions `async`. This means that, as part of /// makes the `memory_growing` and `table_growing` functions `async`. This
/// your resource limiting strategy, the async resource limiter may yield /// means that, as part of your resource limiting strategy, the async
/// execution until a resource becomes available. /// resource limiter may yield execution until a resource becomes
/// available.
/// ///
/// By using a [`ResourceLimiterAsync`] with a [`Store`], you can no /// By using a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`)
/// longer use [`Memory::new`], [`Memory::grow`], [`Table::new`], and /// with a [`Store`], you can no longer use
/// [`Table::grow`]. Instead, you must use their `async` variants: /// [`Memory::new`](`crate::Memory::new`),
/// [`Memory::new_async`], [`Memory::grow_async`], [`Table::new_async`], /// [`Memory::grow`](`crate::Memory::grow`),
/// and [`Table::grow_async`]. /// [`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")] #[cfg(feature = "async")]
pub fn limiter_async( pub fn limiter_async(
&mut self, &mut self,