delete GuestErrorConversion from docs, tests
This commit is contained in:
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/atoms.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> atoms::Atoms for WasiCtx<'a> {
|
||||
fn int_float_args(&self, an_int: u32, an_float: f32) -> Result<(), types::Errno> {
|
||||
|
||||
@@ -12,7 +12,7 @@ wiggle::from_witx!({
|
||||
}
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
#[wiggle::async_trait(?Send)]
|
||||
impl<'a> atoms::Atoms for WasiCtx<'a> {
|
||||
|
||||
@@ -26,9 +26,7 @@ mod convert_just_errno {
|
||||
errors: { errno => RichError },
|
||||
});
|
||||
|
||||
// The impl of GuestErrorConversion works just like in every other test where
|
||||
// we have a single error type with witx `$errno` with the success called `$ok`
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
/// When the `errors` mapping in witx is non-empty, we need to impl the
|
||||
/// types::UserErrorConversion trait that wiggle generates from that mapping.
|
||||
@@ -104,7 +102,7 @@ mod convert_just_errno {
|
||||
/// we use two distinct error types.
|
||||
mod convert_multiple_error_types {
|
||||
pub use super::convert_just_errno::RichError;
|
||||
use wiggle_test::WasiCtx;
|
||||
use wiggle_test::{impl_errno, WasiCtx};
|
||||
|
||||
/// Test that we can map multiple types of errors.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -135,27 +133,8 @@ mod convert_multiple_error_types {
|
||||
errors: { errno => RichError, errno2 => AnotherRichError },
|
||||
});
|
||||
|
||||
// Can't use the impl_errno! macro as usual here because the conversion
|
||||
// trait ends up having two methods.
|
||||
// We aren't going to execute this code, so the bodies are elided.
|
||||
impl<'a> types::GuestErrorConversion for WasiCtx<'a> {
|
||||
fn into_errno(&self, _e: wiggle::GuestError) -> types::Errno {
|
||||
unimplemented!()
|
||||
}
|
||||
fn into_errno2(&self, _e: wiggle::GuestError) -> types::Errno2 {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
impl wiggle::GuestErrorType for types::Errno {
|
||||
fn success() -> types::Errno {
|
||||
<types::Errno>::Ok
|
||||
}
|
||||
}
|
||||
impl wiggle::GuestErrorType for types::Errno2 {
|
||||
fn success() -> types::Errno2 {
|
||||
<types::Errno2>::Ok
|
||||
}
|
||||
}
|
||||
impl_errno!(types::Errno);
|
||||
impl_errno!(types::Errno2);
|
||||
|
||||
// The UserErrorConversion trait will also have two methods for this test. They correspond to
|
||||
// each member of the `errors` mapping.
|
||||
|
||||
@@ -7,7 +7,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/flags.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> flags::Flags for WasiCtx<'a> {
|
||||
fn configure_car(
|
||||
|
||||
@@ -8,7 +8,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/handles.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> handle_examples::HandleExamples for WasiCtx<'a> {
|
||||
fn fd_create(&self) -> Result<types::Fd, types::Errno> {
|
||||
|
||||
@@ -7,7 +7,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/ints.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> ints::Ints for WasiCtx<'a> {
|
||||
fn cookie_cutter(&self, init_cookie: types::Cookie) -> Result<types::Bool, types::Errno> {
|
||||
|
||||
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/lists.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> lists::Lists for WasiCtx<'a> {
|
||||
fn reduce_excuses(
|
||||
|
||||
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/pointers.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> pointers::Pointers for WasiCtx<'a> {
|
||||
fn pointers_and_enums<'b>(
|
||||
|
||||
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/records.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> records::Records for WasiCtx<'a> {
|
||||
fn sum_of_pair(&self, an_pair: &types::PairInts) -> Result<i64, types::Errno> {
|
||||
|
||||
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/strings.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
impl<'a> strings::Strings for WasiCtx<'a> {
|
||||
fn hello_string(&self, a_string: &GuestPtr<str>) -> Result<u32, types::Errno> {
|
||||
|
||||
@@ -6,7 +6,7 @@ wiggle::from_witx!({
|
||||
witx: ["$CARGO_MANIFEST_DIR/tests/variant.witx"],
|
||||
});
|
||||
|
||||
impl_errno!(types::Errno, types::GuestErrorConversion);
|
||||
impl_errno!(types::Errno);
|
||||
|
||||
// Avoid panics on overflow
|
||||
fn mult_lose_overflow(a: i32, b: u32) -> i32 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use wiggle::{GuestError, GuestErrorType, GuestPtr, GuestSlice};
|
||||
use wiggle::{GuestErrorType, GuestPtr, GuestSlice};
|
||||
use wiggle_test::WasiCtx;
|
||||
|
||||
// This test file exists to make sure that the entire `wasi.witx` file can be
|
||||
@@ -31,13 +31,6 @@ impl GuestErrorType for types::Errno {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> types::GuestErrorConversion for WasiCtx<'a> {
|
||||
fn into_errno(&self, e: GuestError) -> types::Errno {
|
||||
eprintln!("GuestError {:?}", e);
|
||||
types::Errno::Badf
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> crate::wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx<'a> {
|
||||
fn args_get(&self, _argv: &GuestPtr<GuestPtr<u8>>, _argv_buf: &GuestPtr<u8>) -> Result<()> {
|
||||
unimplemented!("args_get")
|
||||
|
||||
Reference in New Issue
Block a user