Equivalent of [`CodeBuilder::wasm_binary`] that also accepts the WebAssembly text format. This method will configure the WebAssembly binary to be compiled. The input `wasm_bytes` may either be the wasm text format or the binary format. If the `wat` crate feature is enabled, which is enabled by default, then the text format will automatically be converted to the binary format. # Errors This meth
(
&mut self,
wasm_bytes: &'a [u8],
wasm_path: Option<&'a Path>,
)
| 132 | /// configured. This method will also return an error if `wasm_bytes` is the |
| 133 | /// wasm text format and the text syntax is not valid. |
| 134 | pub fn wasm_binary_or_text( |
| 135 | &mut self, |
| 136 | wasm_bytes: &'a [u8], |
| 137 | wasm_path: Option<&'a Path>, |
| 138 | ) -> Result<&mut Self> { |
| 139 | #[cfg(feature = "wat")] |
| 140 | let wasm_bytes = wat::parse_bytes(wasm_bytes).map_err(|mut e| { |
| 141 | if let Some(path) = wasm_path { |
| 142 | e.set_path(path); |
| 143 | } |
| 144 | e |
| 145 | })?; |
| 146 | self.wasm_binary(wasm_bytes, wasm_path) |
| 147 | } |
| 148 | |
| 149 | /// Reads the `file` specified for the WebAssembly bytes that are going to |
| 150 | /// be compiled. |
no test coverage detected