Fix the documentation build in the component model (#4328)
Currently `cargo doc` fails for a number of broken links and this commit fixes all of them. Currently I don't think it's worth adding this to CI because we don't actually generate docs for the component model anywhere yet. When the component model support is compiled in by default I think it would make sense to implement that.
This commit is contained in:
@@ -127,30 +127,26 @@ impl Func {
|
|||||||
///
|
///
|
||||||
/// This function will perform a type-check at runtime that the [`Func`]
|
/// This function will perform a type-check at runtime that the [`Func`]
|
||||||
/// takes `Params` as parameters and returns `Return`. If the type-check
|
/// takes `Params` as parameters and returns `Return`. If the type-check
|
||||||
/// passes then a [`TypedFunc`] will be returned which can be used to invoke
|
/// passes then a [`TypedFunc`] will be returned which can be used to
|
||||||
/// the function in an efficient, statically-typed, and ergonomic manner.
|
/// invoke the function in an efficient, statically-typed, and ergonomic
|
||||||
|
/// manner.
|
||||||
///
|
///
|
||||||
/// The `Params` type parameter here is a tuple of the parameters to the
|
/// The `Params` type parameter here is a tuple of the parameters to the
|
||||||
/// function. A function which takes no arguments should use `()`, a
|
/// function. A function which takes no arguments should use `()`, a
|
||||||
/// function with one argument should use `(T,)`, etc.
|
/// function with one argument should use `(T,)`, etc. Note that all
|
||||||
|
/// `Params` must also implement the [`Lower`] trait since they're going tin
|
||||||
|
/// to wasm.
|
||||||
///
|
///
|
||||||
/// The `Return` type parameter is the return value of this function. A
|
/// The `Return` type parameter is the return value of this function. A
|
||||||
/// return value of `()` means that there's no return (similar to a Rust
|
/// return value of `()` means that there's no return (similar to a Rust
|
||||||
/// unit return) and otherwise a type `T` can be specified.
|
/// unit return) and otherwise a type `T` can be specified. Note that the
|
||||||
|
/// `Return` must also implement the [`Lift`] trait since it's coming from
|
||||||
|
/// wasm.
|
||||||
///
|
///
|
||||||
/// Types specified here are mainly those that implement the
|
/// Types specified here must implement the [`ComponentType`] trait. This
|
||||||
/// [`ComponentValue`] trait. This trait is implemented for built-in types
|
/// trait is implemented for built-in types to Rust such as integer
|
||||||
/// to Rust such as integer primitives, floats, `Option<T>`, `Result<T, E>`,
|
/// primitives, floats, `Option<T>`, `Result<T, E>`, strings, `Vec<T>`, and
|
||||||
/// strings, and `Vec<T>`. As parameters you'll be passing native Rust
|
/// more. As parameters you'll be passing native Rust types.
|
||||||
/// types.
|
|
||||||
///
|
|
||||||
/// For the `Return` type parameter many types need to be wrapped in a
|
|
||||||
/// [`Value<T>`]. For example functions which return a string should use the
|
|
||||||
/// `Return` type parameter as `Value<String>` instead of a bare `String`.
|
|
||||||
/// The usage of [`Value`] indicates that a type is stored in linear memory.
|
|
||||||
//
|
|
||||||
// FIXME: Having to remember when to use `Value<T>` vs `T` is going to trip
|
|
||||||
// people up using this API. It's not clear, though, how to fix that.
|
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use wasmtime_runtime::{VMCallerCheckedAnyfunc, VMMemoryDefinition, VMOpaqueConte
|
|||||||
/// component.
|
/// component.
|
||||||
///
|
///
|
||||||
/// For more information see the
|
/// For more information see the
|
||||||
/// [`Linker::func_wrap`](crate::component::Linker::func_wrap) documentation.
|
/// [`func_wrap`](crate::component::LinkerInstance::func_wrap) documentation.
|
||||||
pub trait IntoComponentFunc<T, Params, Return> {
|
pub trait IntoComponentFunc<T, Params, Return> {
|
||||||
/// Host entrypoint from a cranelift-generated trampoline.
|
/// Host entrypoint from a cranelift-generated trampoline.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -382,7 +382,8 @@ impl<'a> Instantiator<'a> {
|
|||||||
/// This structure represents an efficient form of instantiation where import
|
/// This structure represents an efficient form of instantiation where import
|
||||||
/// type-checking and import lookup has all been resolved by the time that this
|
/// type-checking and import lookup has all been resolved by the time that this
|
||||||
/// type is created. This type is primarily created through the
|
/// type is created. This type is primarily created through the
|
||||||
/// [`Linker::instance_pre`](crate::component::Linker::instance_pre) method.
|
/// [`Linker::instantiate_pre`](crate::component::Linker::instantiate_pre)
|
||||||
|
/// method.
|
||||||
pub struct InstancePre<T> {
|
pub struct InstancePre<T> {
|
||||||
component: Component,
|
component: Component,
|
||||||
imports: PrimaryMap<RuntimeImportIndex, RuntimeImport>,
|
imports: PrimaryMap<RuntimeImportIndex, RuntimeImport>,
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ impl<T> LinkerInstance<'_, T> {
|
|||||||
///
|
///
|
||||||
/// The [`IntoComponentFunc`] trait is implemented for functions whose
|
/// The [`IntoComponentFunc`] trait is implemented for functions whose
|
||||||
/// arguments and return values implement the
|
/// arguments and return values implement the
|
||||||
/// [`ComponentValue`](crate::component::ComponentValue) trait. Additionally
|
/// [`ComponentType`](crate::component::ComponentType) trait. Additionally
|
||||||
/// the `func` may take a [`StoreContextMut`](crate::StoreContextMut) as its
|
/// the `func` may take a [`StoreContextMut`](crate::StoreContextMut) as its
|
||||||
/// first parameter.
|
/// first parameter.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub use self::func::{
|
|||||||
WasmStr,
|
WasmStr,
|
||||||
};
|
};
|
||||||
pub use self::instance::{Instance, InstancePre};
|
pub use self::instance::{Instance, InstancePre};
|
||||||
pub use self::linker::Linker;
|
pub use self::linker::{Linker, LinkerInstance};
|
||||||
|
|
||||||
// These items are expected to be used by an eventual
|
// These items are expected to be used by an eventual
|
||||||
// `#[derive(ComponentValue)]`, they are not part of Wasmtime's API stability
|
// `#[derive(ComponentValue)]`, they are not part of Wasmtime's API stability
|
||||||
|
|||||||
Reference in New Issue
Block a user