GuestErrorType only needs to have a success constructor

This commit is contained in:
Pat Hickey
2020-03-27 14:31:59 -07:00
parent 9ca3bf532e
commit 167a040ea5
5 changed files with 12 additions and 27 deletions

View File

@@ -314,16 +314,10 @@ impl<'a> WasiCtx<'a> {
#[macro_export]
macro_rules! impl_errno {
( $errno:ty ) => {
impl<'a> wiggle::GuestErrorType<'a> for $errno {
type Context = WasiCtx<'a>;
impl wiggle::GuestErrorType for $errno {
fn success() -> $errno {
<$errno>::Ok
}
fn from_error(e: GuestError, ctx: &WasiCtx) -> $errno {
eprintln!("GUEST ERROR: {:?}", e);
ctx.guest_errors.borrow_mut().push(e);
types::Errno::InvalidArg
}
}
};
}