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

Method wasm_binary_file

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

Reads the `file` specified for the WebAssembly bytes that are going to be compiled. This method will read `file` from the filesystem and interpret it as a WebAssembly binary. A DWARF package file will be probed using the root of `file` and with a `.dwp` extension. If found, it will be loaded and DWARF fusion performed. # Errors This method will return an error if WebAssembly bytes have already

(&mut self, file: &'a Path)

Source from the content-addressed store, hash-verified

167 /// If DWARF fusion is performed and the DWARF packaged file cannot be read
168 /// then an error will be returned.
169 pub fn wasm_binary_file(&mut self, file: &'a Path) -> Result<&mut Self> {
170 let wasm = std::fs::read(file)
171 .with_context(|| format!("failed to read input file: {}", file.display()))?;
172 self.wasm_binary(wasm, Some(file))
173 }
174
175 /// Equivalent of [`CodeBuilder::wasm_binary_file`] that also accepts the
176 /// WebAssembly text format.

Callers 1

Calls 3

with_contextMethod · 0.80
wasm_binaryMethod · 0.80
readFunction · 0.50

Tested by

no test coverage detected