| 977 | } |
| 978 | |
| 979 | inline WitResult WitResult::err(std::optional<Val> v) { |
| 980 | wasmtime_component_valresult_t raw; |
| 981 | raw.is_ok = false; |
| 982 | if (v) { |
| 983 | raw.val = wasmtime_component_val_new(&v->raw); |
| 984 | } else { |
| 985 | raw.val = nullptr; |
| 986 | } |
| 987 | return WitResult(std::move(raw)); |
| 988 | } |
| 989 | |
| 990 | } // namespace component |
| 991 | } // namespace wasmtime |