mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-03 03:08:22 +00:00
chore: Fix doc comments
This commit is contained in:
@@ -5,15 +5,16 @@ use wasmer::*;
|
||||
|
||||
static BENCHMARKS_ARTIFACTS_BASE_URL: &str = "https://pub-083d1a0568d446d1aa5b2e07bd16983b.r2.dev";
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
fn get_engine() -> Engine {
|
||||
#[cfg(feature = "llvm")]
|
||||
return LLVM::new().into();
|
||||
return sys::LLVM::new().into();
|
||||
|
||||
#[cfg(feature = "singlepass")]
|
||||
return Singlepass::new().into();
|
||||
return sys::Singlepass::new().into();
|
||||
|
||||
#[cfg(feature = "cranelift")]
|
||||
return Cranelift::new().into();
|
||||
return sys::Cranelift::new().into();
|
||||
|
||||
#[cfg(not(any(feature = "cranelift", feature = "llvm", feature = "singlepass")))]
|
||||
return Default::default();
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::{
|
||||
gen_rt_ty!(Engine @derives Debug, Clone);
|
||||
|
||||
impl BackendEngine {
|
||||
/// Returns the [`crate::Runtime`] kind this engine belongs to.
|
||||
/// Returns the [`crate::BackendKind`] kind this engine belongs to.
|
||||
#[inline]
|
||||
pub fn get_be_kind(&self) -> crate::BackendKind {
|
||||
match self {
|
||||
@@ -45,7 +45,7 @@ impl BackendEngine {
|
||||
/// `Module::serialize`,
|
||||
///
|
||||
/// # Note
|
||||
/// You should almost always prefer [`EngineLike::deserialize`].
|
||||
/// You should almost always prefer [`Self::deserialize`].
|
||||
///
|
||||
/// # Errors
|
||||
/// Not every implementer supports serializing and deserializing modules.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//! Defines the [`Engine`] type, the [`EngineLike`] trait for implementors and useful
|
||||
//! traits and data types to interact with them.
|
||||
//! Defines the [`self::Engine`] type and useful traits and data types to interact with an engine.
|
||||
|
||||
use bytes::Bytes;
|
||||
use std::{path::Path, sync::Arc};
|
||||
@@ -68,7 +67,7 @@ impl Engine {
|
||||
/// `Module::serialize`,
|
||||
///
|
||||
/// # Note
|
||||
/// You should almost always prefer [`EngineLike::deserialize`].
|
||||
/// You should almost always prefer [`Self::deserialize`].
|
||||
///
|
||||
/// # Errors
|
||||
/// Not every implementer supports serializing and deserializing modules.
|
||||
|
||||
@@ -34,7 +34,7 @@ impl BackendFunction {
|
||||
/// Creates a new host `Function` (dynamic) with the provided signature.
|
||||
///
|
||||
/// If you know the signature of the host function at compile time,
|
||||
/// consider using [`Function::new_typed`] for less runtime overhead.
|
||||
/// consider using [`Self::new_typed`] for less runtime overhead.
|
||||
#[inline]
|
||||
pub fn new<FT, F>(store: &mut impl AsStoreMut, ty: FT, func: F) -> Self
|
||||
where
|
||||
@@ -51,10 +51,10 @@ impl BackendFunction {
|
||||
/// Creates a new host `Function` (dynamic) with the provided signature.
|
||||
///
|
||||
/// If you know the signature of the host function at compile time,
|
||||
/// consider using [`Function::new_typed_with_env`] for less runtime overhead.
|
||||
/// consider using [`Self::new_typed_with_env`] for less runtime overhead.
|
||||
///
|
||||
/// Takes a [`FunctionEnv`] that is passed into func. If that is not required,
|
||||
/// [`Function::new`] might be an option as well.
|
||||
/// [`Self::new`] might be an option as well.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Defines the [`Function`] and [`HostFunction`] types, the [`FunctionLike`] trait for implementors and useful
|
||||
//! traits and data types to interact with them.
|
||||
//! Defines the [`Function`] and [`HostFunction`] types and useful traits and data types to
|
||||
//! interact with them.
|
||||
|
||||
pub(crate) mod inner;
|
||||
pub use inner::*;
|
||||
@@ -23,8 +23,8 @@ use crate::{
|
||||
///
|
||||
/// A function instance is the runtime representation of a function.
|
||||
/// It effectively is a closure of the original function (defined in either
|
||||
/// the host or the WebAssembly module) over the runtime `Instance` of its
|
||||
/// originating `Module`.
|
||||
/// the host or the WebAssembly module) over the runtime [`crate::Instance`] of its
|
||||
/// originating [`crate::Module`].
|
||||
///
|
||||
/// The module instance is used to resolve references to other definitions
|
||||
/// during execution of the function.
|
||||
|
||||
@@ -13,7 +13,7 @@ gen_rt_ty!(Memory
|
||||
);
|
||||
|
||||
impl BackendMemory {
|
||||
/// Creates a new host [`Memory`] from the provided [`MemoryType`].
|
||||
/// Creates a new host [`BackendMemory`] from the provided [`MemoryType`].
|
||||
///
|
||||
/// This function will construct the `Memory` using the store
|
||||
/// `BaseTunables`.
|
||||
@@ -105,7 +105,7 @@ impl BackendMemory {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the [`MemoryType`] of the `Memory`.
|
||||
/// Returns the [`MemoryType`] of the [`BackendMemory`].
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
||||
@@ -24,24 +24,24 @@ impl From<u32> for MemoryLocation {
|
||||
}
|
||||
}
|
||||
|
||||
/// See [`SharedMemory`].
|
||||
/// See [`crate::SharedMemory`].
|
||||
pub(crate) trait SharedMemoryOps {
|
||||
/// See [`SharedMemory::disable_atomics`].
|
||||
/// See [`crate::SharedMemory::disable_atomics`].
|
||||
fn disable_atomics(&self) -> Result<(), MemoryError> {
|
||||
Err(MemoryError::AtomicsNotSupported)
|
||||
}
|
||||
|
||||
/// See [`SharedMemory::wake_all_atomic_waiters`].
|
||||
/// See [`crate::SharedMemory::wake_all_atomic_waiters`].
|
||||
fn wake_all_atomic_waiters(&self) -> Result<(), MemoryError> {
|
||||
Err(MemoryError::AtomicsNotSupported)
|
||||
}
|
||||
|
||||
/// See [`SharedMemory::notify`].
|
||||
/// See [`crate::SharedMemory::notify`].
|
||||
fn notify(&self, _dst: MemoryLocation, _count: u32) -> Result<u32, AtomicsError> {
|
||||
Err(AtomicsError::Unimplemented)
|
||||
}
|
||||
|
||||
/// See [`SharedMemory::wait`].
|
||||
/// See [`crate::SharedMemory::wait`].
|
||||
fn wait(
|
||||
&self,
|
||||
_dst: MemoryLocation,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Defines the [`Module`] data type, the [`ModuleLike`] trait for implementers and various useful traits
|
||||
//! and data types to interact with them.
|
||||
//! Defines the [`BackendModule`] data type and various useful traits and data types to interact with
|
||||
//! a concrete module from a backend.
|
||||
|
||||
use std::{fs, path::Path};
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::{
|
||||
AsEngineRef,
|
||||
};
|
||||
|
||||
/// IO errors that can happen while compiling a [`Module`].
|
||||
/// IO errors that can happen while compiling a [`BackendModule`].
|
||||
#[derive(Error, Debug)]
|
||||
pub enum IoCompileError {
|
||||
/// An IO error
|
||||
@@ -73,7 +73,7 @@ impl BackendModule {
|
||||
|
||||
/// Creates a new WebAssembly module from a Wasm binary.
|
||||
///
|
||||
/// Opposed to [`Module::new`], this function is not compatible with
|
||||
/// Opposed to [`Self::new`], this function is not compatible with
|
||||
/// the WebAssembly text format (if the "wat" feature is enabled for
|
||||
/// this crate).
|
||||
#[inline]
|
||||
@@ -206,7 +206,7 @@ impl BackendModule {
|
||||
}
|
||||
|
||||
/// Serializes a module into a binary representation that the `Engine`
|
||||
/// can later process via [`Module::deserialize`].
|
||||
/// can later process via [`Self::deserialize`].
|
||||
///
|
||||
/// # Important
|
||||
///
|
||||
@@ -232,7 +232,7 @@ impl BackendModule {
|
||||
}
|
||||
|
||||
/// Serializes a module into a file that the `Engine`
|
||||
/// can later process via [`Module::deserialize_from_file`].
|
||||
/// can later process via [`Self::deserialize_from_file`].
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
@@ -254,7 +254,7 @@ impl BackendModule {
|
||||
|
||||
/// Deserializes a serialized module binary into a `Module`.
|
||||
///
|
||||
/// Note: You should usually prefer the safer [`Module::deserialize`].
|
||||
/// Note: You should usually prefer the safer [`Self::deserialize`].
|
||||
///
|
||||
/// # Important
|
||||
///
|
||||
@@ -332,7 +332,7 @@ impl BackendModule {
|
||||
/// This function only accepts a custom binary format, which will be different
|
||||
/// than the `wasm` binary format and may change among Wasmer versions.
|
||||
/// (it should be the result of the serialization of a Module via the
|
||||
/// `Module::serialize` method.).
|
||||
/// [`Self::serialize`] method.).
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
@@ -442,11 +442,11 @@ impl BackendModule {
|
||||
/// Deserializes a serialized Module located in a `Path` into a `Module`.
|
||||
/// > Note: the module has to be serialized before with the `serialize` method.
|
||||
///
|
||||
/// You should usually prefer the safer [`Module::deserialize_from_file`].
|
||||
/// You should usually prefer the safer [`Self::deserialize_from_file`].
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Please check [`Module::deserialize_unchecked`].
|
||||
/// Please check [`Self::deserialize_unchecked`].
|
||||
///
|
||||
/// # Usage
|
||||
///
|
||||
@@ -507,7 +507,7 @@ impl BackendModule {
|
||||
/// Returns the name of the current module.
|
||||
///
|
||||
/// This name is normally set in the WebAssembly bytecode by some
|
||||
/// compilers, but can be also overwritten using the [`Module::set_name`] method.
|
||||
/// compilers, but can be also overwritten using the [`Self::set_name`] method.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Defines the [`Module`] data type, the [`ModuleLike`] trait for implementers and various useful traits
|
||||
//! and data types to interact with them.
|
||||
//! Defines the [`Module`] data type and various useful traits and data types to interact with a
|
||||
//! module.
|
||||
|
||||
pub(crate) mod inner;
|
||||
pub(crate) use inner::*;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Defines the [`Store`] data type, the [`StoreLike`] trait for implementers and various useful traits
|
||||
//! and data types to interact with them.
|
||||
//! Defines the [`Store`] data type and various useful traits and data types to interact with a
|
||||
//! store.
|
||||
|
||||
/// Defines the [`StoreInner`] data type and the [`StoreLike`] trait.
|
||||
/// Defines the [`StoreInner`] data type.
|
||||
mod inner;
|
||||
|
||||
/// Create temporary handles to engines.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Useful data types, functions and traits used throughout the crate to interact with WebAssembly
|
||||
//! entities such as [`Memory`] and [`Value`].
|
||||
//! entities such as [`crate::Memory`] and [`crate::Value`].
|
||||
|
||||
/// Convert bynary data into [`bytes::Bytes`].
|
||||
mod into_bytes;
|
||||
|
||||
Reference in New Issue
Block a user