| 243 | } |
| 244 | |
| 245 | fn execution_flags(&self) -> Result<CommonOptions> { |
| 246 | let flags = if self.execution_flags_ptr.is_null() { |
| 247 | "" |
| 248 | } else { |
| 249 | let execution_flags = unsafe { |
| 250 | std::slice::from_raw_parts(self.execution_flags_ptr, self.execution_flags_len) |
| 251 | }; |
| 252 | std::str::from_utf8(execution_flags) |
| 253 | .context("given execution flags string is not valid UTF-8")? |
| 254 | }; |
| 255 | let options = CommonOptions::try_parse_from( |
| 256 | ["wasmtime"] |
| 257 | .into_iter() |
| 258 | .chain(flags.split(' ').filter(|s| !s.is_empty())), |
| 259 | ) |
| 260 | .context("failed to parse options")?; |
| 261 | Ok(options) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | /// Exposes a C-compatible way of creating the engine from the bytes of a single |