zwasm-sdk 0.1.0

A safe and ergonomic Rust binding for the zwasm WebAssembly runtime, supporting Wasm 3.0, WASI, and host function imports.
1
2
3
4
5
use crate::error;

pub(crate) fn to_u32_len(len: usize) -> Result<u32, error::ZwasmError> {
    u32::try_from(len).map_err(|_| error::ZwasmError(format!("length exceeds u32::MAX: {len}")))
}