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

Method wasm_binary

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

Configures the WebAssembly binary that is being compiled. The `wasm_bytes` parameter must be a binary WebAssembly file. This will be stored within the [`CodeBuilder`] for processing later when compilation is finalized. The optional `wasm_path` parameter is the path to the `wasm_bytes` on disk, if any. This may be used for diagnostics and other debugging-related purposes, but this method will not

(
        &mut self,
        wasm_bytes: impl Into<Cow<'a, [u8]>>,
        wasm_path: Option<&'a Path>,
    )

Source from the content-addressed store, hash-verified

100 /// This method will return an error if WebAssembly bytes have already been
101 /// configured.
102 pub fn wasm_binary(
103 &mut self,
104 wasm_bytes: impl Into<Cow<'a, [u8]>>,
105 wasm_path: Option<&'a Path>,
106 ) -> Result<&mut Self> {
107 if self.wasm.is_some() {
108 bail!("cannot configure wasm bytes twice");
109 }
110 self.wasm = Some(wasm_bytes.into());
111 self.wasm_path = wasm_path.map(|p| p.into());
112
113 if self.wasm_path.is_some() {
114 self.dwarf_package_from_wasm_path()?;
115 }
116
117 Ok(self)
118 }
119
120 /// Equivalent of [`CodeBuilder::wasm_binary`] that also accepts the
121 /// WebAssembly text format.

Callers 6

compileMethod · 0.80
wasm_binary_or_textMethod · 0.80
wasm_binary_fileMethod · 0.80
from_binaryMethod · 0.80
from_binaryMethod · 0.80

Calls 4

OkFunction · 0.85
is_someMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected