Skip to content

Commit

Permalink
fix(api): Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xdoardo committed Nov 22, 2024
1 parent 88518b6 commit 3dc6cf0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion lib/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,5 +384,6 @@ fn main() {
build_wamr();

#[cfg(feature = "v8")]
build_v8()
build_v8();

}
2 changes: 1 addition & 1 deletion lib/api/src/entities/engine/engine_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait AsEngineRef {
/// Create a [`StoreRef`].
///
/// NOTE: this function will return [`None`] if the [`AsEngineRef`] implementor is not an
/// actual [`Store`].
/// actual [`crate::Store`].
fn maybe_as_store(&self) -> Option<StoreRef<'_>> {
None
}
Expand Down
4 changes: 2 additions & 2 deletions lib/api/src/entities/store/store_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use wasmer_types::{ExternType, OnCalledAction};
#[cfg(feature = "sys")]
use wasmer_vm::TrapHandlerFn;

/// A temporary handle to a [`Store`].
/// A temporary handle to a [`crate::Store`].
#[derive(Debug)]
pub struct StoreRef<'a> {
pub(crate) inner: &'a StoreInner,
Expand Down Expand Up @@ -39,7 +39,7 @@ impl<'a> StoreRef<'a> {
}
}

/// A temporary handle to a [`Store`].
/// A temporary handle to a [`crate::Store`].
pub struct StoreMut<'a> {
pub(crate) inner: &'a mut StoreInner,
}
Expand Down
3 changes: 3 additions & 0 deletions lib/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@
//! [`wasmer-wasix`]: https://docs.rs/wasmer-wasix/
//! [`wasm-pack`]: https://github.com/rustwasm/wasm-pack/
//! [`wasm-bindgen`]: https://github.com/rustwasm/wasm-bindgen
//! [`v8`]: https://v8.dev/
//! [`wamr`]: https://github.com/bytecodealliance/wasm-micro-runtime
//! [`wasmi`]: https://github.com/wasmi-labs/wasmi

#[cfg(not(any(
feature = "sys",
Expand Down
6 changes: 3 additions & 3 deletions lib/api/src/rt/sys/entities/function/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@ impl<T> FunctionEnv<T> {
}

impl<T> crate::FunctionEnv<T> {
/// Consume [`self`] into [`crate::rt::sys::function::env::FunctionEnv`].
/// Consume self into [`crate::rt::sys::function::FunctionEnv`].
pub fn into_sys(self) -> FunctionEnv<T> {
match self.0 {
crate::RuntimeFunctionEnv::Sys(s) => s,
_ => panic!("Not a `sys` function env!"),
}
}

/// Convert a reference to [`self`] into a reference to [`crate::rt::sys::function::env::FunctionEnv`].
/// Convert a reference to self into a reference to [`crate::rt::sys::function::FunctionEnv`].
pub fn as_sys(&self) -> &FunctionEnv<T> {
match self.0 {
crate::RuntimeFunctionEnv::Sys(ref s) => s,
_ => panic!("Not a `sys` function env!"),
}
}

/// Convert a mutable reference to [`self`] into a mutable reference [`crate::rt::sys::function::env::FunctionEnv`].
/// Convert a mutable reference to self into a mutable reference [`crate::rt::sys::function::FunctionEnv`].
pub fn as_sys_mut(&mut self) -> &mut FunctionEnv<T> {
match self.0 {
crate::RuntimeFunctionEnv::Sys(ref mut s) => s,
Expand Down
6 changes: 3 additions & 3 deletions lib/api/src/rt/sys/entities/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,23 +328,23 @@ unsafe fn volatile_memcpy_write(mut src: *const u8, mut dst: *mut u8, mut len: u
}

impl crate::Memory {
/// Consume [`self`] into a [`crate::rt::sys::mem::Memory`].
/// Consume [`self`] into a [`crate::rt::sys::memory::Memory`].
pub fn into_sys(self) -> crate::rt::sys::memory::Memory {
match self.0 {
RuntimeMemory::Sys(s) => s,
_ => panic!("Not a `sys` memory!"),
}
}

/// Convert a reference to [`self`] into a reference to [`crate::rt::sys::mem::Memory`].
/// Convert a reference to [`self`] into a reference to [`crate::rt::sys::memory::Memory`].
pub fn as_sys(&self) -> &crate::rt::sys::memory::Memory {
match self.0 {
RuntimeMemory::Sys(ref s) => s,
_ => panic!("Not a `sys` memory!"),
}
}

/// Convert a mutable reference to [`self`] into a mutable reference to [`crate::rt::sys::mem::Memory`].
/// Convert a mutable reference to [`self`] into a mutable reference to [`crate::rt::sys::memory::Memory`].
pub fn as_sys_mut(&mut self) -> &mut crate::rt::sys::memory::Memory {
match self.0 {
RuntimeMemory::Sys(ref mut s) => s,
Expand Down
6 changes: 3 additions & 3 deletions lib/api/src/rt/sys/entities/store/obj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ use wasmer_vm::StoreId;
use crate::AsStoreMut;

impl crate::StoreObjects {
/// Consume [`self`] into [`crate::rt::sys::store::StoreObjects`].
/// Consume store objects into [`crate::rt::sys::store::StoreObjects`].
pub fn into_sys(self) -> crate::rt::sys::store::StoreObjects {
match self {
Self::Sys(s) => s,
_ => panic!("Not a `sys` store!"),
}
}

/// Convert a reference to [`self`] into a reference [`crate::rt::sys::store::StoreObjects`].
/// Convert a reference to store objects into a reference [`crate::rt::sys::store::StoreObjects`].
pub fn as_sys(&self) -> &crate::rt::sys::store::StoreObjects {
match self {
Self::Sys(s) => s,
_ => panic!("Not a `sys` store!"),
}
}

/// Convert a mutable reference to [`self`] into a mutable reference [`crate::rt::sys::store::StoreObjects`].
/// Convert a mutable reference to store objects into a mutable reference [`crate::rt::sys::store::StoreObjects`].
pub fn as_sys_mut(&mut self) -> &mut crate::rt::sys::store::StoreObjects {
match self {
Self::Sys(s) => s,
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/utils/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use access::{WasmRefAccess, WasmSliceAccess};
use thiserror::Error;
pub use wasmer_types::{Memory32, Memory64, MemorySize, ValueType};

/// Error for invalid [`Memory`][super::Memory] access.
/// Error for invalid [`Memory`][crate::Memory] access.
#[derive(Clone, Copy, Debug, Error)]
#[non_exhaustive]
pub enum MemoryAccessError {
Expand Down

0 comments on commit 3dc6cf0

Please sign in to comment.