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>,
)
| 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. |
no test coverage detected