mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-15 23:25:41 +00:00
14 lines
336 B
Rust
14 lines
336 B
Rust
macro_rules! wasi_try {
|
|
($expr:expr) => {{
|
|
let res: Result<_, crate::syscalls::types::__wasi_errno_t> = $expr;
|
|
match res {
|
|
Ok(val) => val,
|
|
Err(err) => return err,
|
|
}
|
|
}};
|
|
($expr:expr; $e:expr) => {{
|
|
let opt: Option<_> = $expr;
|
|
wasi_try!(opt.ok_or($e))
|
|
}};
|
|
}
|