Make conversions to wasmtime::Result
postfix-friendly (#10082)
This PR refactors the conversions to `wasmtime::Result` to use a trait so that we can perform the conversions in a postfix-friendly way. Release Notes: - N/A
This commit is contained in:
parent
c62239e9f0
commit
a1cb6772bf
2 changed files with 59 additions and 59 deletions
|
@ -119,3 +119,13 @@ impl Extension {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait ToWasmtimeResult<T> {
|
||||
fn to_wasmtime_result(self) -> wasmtime::Result<Result<T, String>>;
|
||||
}
|
||||
|
||||
impl<T> ToWasmtimeResult<T> for Result<T> {
|
||||
fn to_wasmtime_result(self) -> wasmtime::Result<Result<T, String>> {
|
||||
Ok(self.map_err(|error| error.to_string()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue