cranelift_wasm::wasmparser

Function validate

Source
pub fn validate(bytes: &[u8]) -> Result<Types, BinaryReaderError>
Expand description

Test whether the given buffer contains a valid WebAssembly module or component, analogous to WebAssembly.validate in the JS API.

This functions requires the bytes to validate are entirely resident in memory. Additionally this validates the given bytes with the default set of WebAssembly features implemented by wasmparser.

For more fine-tuned control over validation it’s recommended to review the documentation of Validator.

Upon success, the type information for the top-level module or component will be returned.