MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / hint

Method hint

crates/wasmtime/src/compile/code_builder.rs:734–743  ·  view source on GitHub ↗

Returns a hint, if possible, of what the provided bytes are. This method can be use to detect what the previously supplied bytes to methods such as [`CodeBuilder::wasm_binary_or_text`] are. This will return whether a module or a component was found in the provided bytes. This method will return `None` if wasm bytes have not been configured or if the provided bytes don't look like either a compon

(&self)

Source from the content-addressed store, hash-verified

732 /// or if the provided bytes don't look like either a component or a
733 /// module.
734 pub fn hint(&self) -> Option<CodeHint> {
735 let wasm = self.wasm.as_ref()?;
736 if wasmparser::Parser::is_component(wasm) {
737 Some(CodeHint::Component)
738 } else if wasmparser::Parser::is_core_wasm(wasm) {
739 Some(CodeHint::Module)
740 } else {
741 None
742 }
743 }
744
745 /// Finishes this compilation and produces a serialized list of bytes.
746 ///

Callers 5

load_module_contentsMethod · 0.80
compile_to_cwasmMethod · 0.80
executeMethod · 0.80
compileMethod · 0.80
compileMethod · 0.80

Calls 1

as_refMethod · 0.45

Tested by

no test coverage detected