Browse Source

fix all docs links

pull/3393/head
Pat Hickey 3 years ago
parent
commit
6819459082
  1. 30
      crates/wasmtime/src/externals.rs
  2. 7
      crates/wasmtime/src/limits.rs
  3. 26
      crates/wasmtime/src/memory.rs
  4. 26
      crates/wasmtime/src/store.rs

30
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<T>(
mut store: impl AsContextMut<Data = T>,
@ -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<u32> {
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<T>(
&self,

7
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 {

26
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<T>(
mut store: impl AsContextMut<Data = T>,
@ -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<T>(
&self,

26
crates/wasmtime/src/store.rs

@ -541,16 +541,22 @@ impl<T> Store<T> {
/// 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,

Loading…
Cancel
Save