decode

Function decode 

Source
pub fn decode(wasm: &[u8]) -> Result<(Vec<u8>, Bindgen)>
Expand description

This function will parse the wasm binary given as input and return a Bindgen which extracts the custom sections describing component-level types from within the binary itself.

This is used to parse the output of wit-bindgen-generated modules and is one of the earliest phases in transitioning such a module to a component. The extraction here provides the metadata necessary to continue the process later on.

This will return an error if wasm is not a valid WebAssembly module.

Note that a “stripped” binary where component-type sections are removed is returned as well to embed within a component.