summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/archive.rs8
-rw-r--r--crates/types/src/lib.rs8
-rw-r--r--crates/types/src/value.rs16
3 files changed, 16 insertions, 16 deletions
diff --git a/crates/types/src/archive.rs b/crates/types/src/archive.rs
index 0a57f4c..398b616 100644
--- a/crates/types/src/archive.rs
+++ b/crates/types/src/archive.rs
@@ -54,16 +54,16 @@ extern crate std;
impl std::error::Error for TwasmError {}
impl TinyWasmModule {
- /// Creates a TinyWasmModule from a slice of bytes.
+ /// Creates a `TinyWasmModule` from a slice of bytes.
pub fn from_twasm(wasm: &[u8]) -> Result<TinyWasmModule, TwasmError> {
let len = validate_magic(wasm)?;
let root = check_archived_root::<Self>(&wasm[len..]).map_err(|_e| TwasmError::InvalidArchive)?;
Ok(root.deserialize(&mut rkyv::Infallible).unwrap())
}
- /// Serializes the TinyWasmModule into a vector of bytes.
- /// AlignedVec can be deferenced as a slice of bytes and
- /// implements io::Write when the `std` feature is enabled.
+ /// Serializes the `TinyWasmModule` into a vector of bytes.
+ /// `AlignedVec` can be deferenced as a slice of bytes and
+ /// implements `io::Write` when the `std` feature is enabled.
pub fn serialize_twasm(&self) -> rkyv::AlignedVec {
let mut serializer = AllocSerializer::<0>::default();
serializer.pad(TWASM_MAGIC.len()).unwrap();
diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs
index a4029e2..94dc94d 100644
--- a/crates/types/src/lib.rs
+++ b/crates/types/src/lib.rs
@@ -37,11 +37,11 @@ pub use value::*;
#[cfg(feature = "archive")]
pub mod archive;
-/// A TinyWasm WebAssembly Module
+/// A `TinyWasm` WebAssembly Module
///
-/// This is the internal representation of a WebAssembly module in TinyWasm.
-/// TinyWasmModules are validated before being created, so they are guaranteed to be valid (as long as they were created by TinyWasm).
-/// This means you should not trust a TinyWasmModule created by a third party to be valid.
+/// This is the internal representation of a WebAssembly module in `TinyWasm`.
+/// `TinyWasmModules` are validated before being created, so they are guaranteed to be valid (as long as they were created by `TinyWasm`).
+/// This means you should not trust a `TinyWasmModule` created by a third party to be valid.
#[derive(Debug, Clone, Default, PartialEq)]
#[cfg_attr(feature = "archive", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize), archive(check_bytes))]
pub struct TinyWasmModule {
diff --git a/crates/types/src/value.rs b/crates/types/src/value.rs
index c418338..416f678 100644
--- a/crates/types/src/value.rs
+++ b/crates/types/src/value.rs
@@ -87,14 +87,14 @@ fn cold() {}
impl Debug for WasmValue {
fn fmt(&self, f: &mut alloc::fmt::Formatter<'_>) -> alloc::fmt::Result {
match self {
- WasmValue::I32(i) => write!(f, "i32({})", i),
- WasmValue::I64(i) => write!(f, "i64({})", i),
- WasmValue::F32(i) => write!(f, "f32({})", i),
- WasmValue::F64(i) => write!(f, "f64({})", i),
- WasmValue::V128(i) => write!(f, "v128({:?})", i),
- WasmValue::RefExtern(addr) => write!(f, "ref.extern({:?})", addr),
- WasmValue::RefFunc(addr) => write!(f, "ref.func({:?})", addr),
- WasmValue::RefNull(ty) => write!(f, "ref.null({:?})", ty),
+ WasmValue::I32(i) => write!(f, "i32({i})"),
+ WasmValue::I64(i) => write!(f, "i64({i})"),
+ WasmValue::F32(i) => write!(f, "f32({i})"),
+ WasmValue::F64(i) => write!(f, "f64({i})"),
+ WasmValue::V128(i) => write!(f, "v128({i:?})"),
+ WasmValue::RefExtern(addr) => write!(f, "ref.extern({addr:?})"),
+ WasmValue::RefFunc(addr) => write!(f, "ref.func({addr:?})"),
+ WasmValue::RefNull(ty) => write!(f, "ref.null({ty:?})"),
}
}
}