diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-08-12 16:12:07 +0200 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-08-12 16:12:07 +0200 |
| commit | 06f81026eca6446d737e3759951ca15001a819c5 (patch) | |
| tree | e06d747eb225cac6e24557faa2694895d52741ae /crates/types/src | |
| parent | d33a0c66a17316755e572b3620fb030ec1e52f61 (diff) | |
chore: clean up code
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
| -rw-r--r-- | crates/types/src/archive.rs | 8 | ||||
| -rw-r--r-- | crates/types/src/lib.rs | 8 | ||||
| -rw-r--r-- | crates/types/src/value.rs | 16 |
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:?})"), } } } |
