generate: now we have a way to do errors, i guess
This commit is contained in:
17
src/lib.rs
17
src/lib.rs
@@ -1,6 +1,21 @@
|
||||
pub mod test {
|
||||
pub struct WasiCtx {} // FIXME: parameterize macro on what ctx type is used here
|
||||
generate::from_witx!("test.witx");
|
||||
|
||||
pub struct WasiCtx {} // FIXME: parameterize macro on what ctx type is used here
|
||||
|
||||
impl types::WitxErrorConversion for WasiCtx {
|
||||
fn success_to_errno(&mut self) -> types::Errno {
|
||||
types::Errno::Ok
|
||||
}
|
||||
fn memory_error_to_errno(&mut self, e: ::memory::MemoryError) -> types::Errno {
|
||||
eprintln!("memory error: {:?}", e);
|
||||
types::Errno::InvalidArg
|
||||
}
|
||||
fn value_error_to_errno(&mut self, e: ::memory::GuestValueError) -> types::Errno {
|
||||
eprintln!("guest value error: {:?}", e);
|
||||
types::Errno::InvalidArg
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
pub mod wasi {
|
||||
|
||||
Reference in New Issue
Block a user