doc(api) Improve documentation of HostFunctionKind and impls.

This commit is contained in:
Ivan Enderlin
2020-06-22 14:05:19 +02:00
parent f8dfdae520
commit 818706b318

View File

@@ -630,28 +630,27 @@ mod inner {
} }
/// Empty trait to specify the kind of `HostFunction`: With or /// Empty trait to specify the kind of `HostFunction`: With or
/// without a `vm::Ctx` argument. See the `ExplicitVmCtx` and the /// without an environment.
/// `ImplicitVmCtx` structures.
/// ///
/// This trait is never aimed to be used by a user. It is used by the /// This trait is never aimed to be used by a user. It is used by
/// trait system to automatically generate an appropriate `wrap` /// the trait system to automatically generate the appropriate
/// function. /// host functions.
#[doc(hidden)] #[doc(hidden)]
pub trait HostFunctionKind {} pub trait HostFunctionKind {}
/// An empty struct to help Rust typing to determine /// An empty struct to help Rust typing to determine
/// when a `HostFunction` doesn't take an Environment /// when a `HostFunction` does have an environment.
pub struct WithEnv {} pub struct WithEnv;
impl HostFunctionKind for WithEnv {} impl HostFunctionKind for WithEnv {}
/// An empty struct to help Rust typing to determine /// An empty struct to help Rust typing to determine
/// when a `HostFunction` takes an Environment /// when a `HostFunction` does not have an environment.
pub struct WithoutEnv {} pub struct WithoutEnv;
impl HostFunctionKind for WithoutEnv {} impl HostFunctionKind for WithoutEnv {}
/// Represents a function that can be used by WebAssembly. /// Represents a low-level Wasm host function.
#[derive(Clone, Debug, Hash, PartialEq, Eq)] #[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct Function<Args = (), Rets = ()> { pub struct Function<Args = (), Rets = ()> {
address: *const VMFunctionBody, address: *const VMFunctionBody,