wiggle: revamp error type conversions

This commit is contained in:
Pat Hickey
2020-03-27 18:27:17 -07:00
parent 167a040ea5
commit 3e97e5f1ae
14 changed files with 76 additions and 24 deletions

View File

@@ -313,11 +313,17 @@ impl<'a> WasiCtx<'a> {
// with these errors. We just push them to vecs.
#[macro_export]
macro_rules! impl_errno {
( $errno:ty ) => {
( $errno:ty, $convert:path ) => {
impl wiggle::GuestErrorType for $errno {
fn success() -> $errno {
<$errno>::Ok
}
}
impl<'a> $convert for WasiCtx<'a> {
fn into_errno(&self, e: wiggle::GuestError) -> $errno {
eprintln!("GuestError: {:?}", e);
<$errno>::InvalidArg
}
}
};
}