Skip to main content

Crate use_wasm_memory

Crate use_wasm_memory 

Source
Expand description

§use-wasm-memory

WebAssembly linear memory primitives for RustUse. This crate models page counts, memory limits, shared-memory markers, and page-size conversions.

§Example

use use_wasm_memory::{MemoryLimits, WasmPageCount};

let limits = MemoryLimits::new(WasmPageCount::new(1), Some(WasmPageCount::new(2)))
    .expect("valid limits");

assert_eq!(limits.minimum_pages(), 1);
assert_eq!(limits.maximum_pages(), Some(2));

§Scope

  • Wasm page counts and byte conversions.
  • Minimum/maximum memory limits and shared marker.

§Non-goals

  • No memory allocation.
  • No runtime memory access.

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Structs§

MemoryLimits
Linear memory limit metadata.
MemoryMaximum
Maximum linear memory size marker.
MemoryMinimum
Minimum linear memory size marker.
WasmPageCount
WebAssembly page count.

Enums§

SharedMemory
Shared linear memory marker.
WasmMemoryError
Error returned when memory limits are invalid.

Constants§

WASM_PAGE_SIZE_BYTES
WebAssembly page size in bytes.
WASM_PAGE_SIZE_KIB
WebAssembly page size in KiB.