Shuffle around the wiggle crates (#1414)
* Shuffle around the wiggle crates This commit reorganizes the wiggle crates slightly by performing the following transforms: * The `crates/wiggle` crate, previously named `wiggle`, was moved to `crates/wiggle/crates/macro` and is renamed to `wiggle-macro`. * The `crates/wiggle/crates/runtime` crate, previously named `wiggle-runtime`, was moved to `crates/wiggle` and is renamed to `wiggle`. * The new `wiggle` crate depends on `wiggle-macro` and reexports the macro. The goal here is that consumers only deal with the `wiggle` crate itself. No more crates depend on `wiggle-runtime` and all dependencies are entirely on just the `wiggle` crate. * Remove the `crates/wiggle/crates` directory Move everything into `crates/wiggle` directly, like `wasi-common` * Add wiggle-macro to test-all script * Fixup a test
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::wasi::{types, Errno, Result};
|
||||
use crate::{entry::Descriptor, entry::Entry};
|
||||
use std::path::{Component, Path};
|
||||
use std::str;
|
||||
use wiggle_runtime::{GuestBorrows, GuestPtr};
|
||||
use wiggle::{GuestBorrows, GuestPtr};
|
||||
|
||||
pub(crate) use sys::path::*;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::cell::Ref;
|
||||
use std::convert::TryInto;
|
||||
use std::fs::File;
|
||||
use std::io::{self, Read, Seek, SeekFrom, Write};
|
||||
use wiggle_runtime::{GuestBorrows, GuestPtr};
|
||||
use wiggle::{GuestBorrows, GuestPtr};
|
||||
|
||||
impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
fn args_get<'b>(
|
||||
|
||||
@@ -11,23 +11,23 @@ wiggle::from_witx!({
|
||||
pub use types::Errno;
|
||||
pub type Result<T> = std::result::Result<T, Errno>;
|
||||
|
||||
impl<'a> wiggle_runtime::GuestErrorType<'a> for Errno {
|
||||
impl<'a> wiggle::GuestErrorType<'a> for Errno {
|
||||
type Context = WasiCtx;
|
||||
|
||||
fn success() -> Self {
|
||||
Self::Success
|
||||
}
|
||||
|
||||
fn from_error(e: wiggle_runtime::GuestError, _ctx: &Self::Context) -> Self {
|
||||
fn from_error(e: wiggle::GuestError, _ctx: &Self::Context) -> Self {
|
||||
eprintln!("Guest error: {:?}", e);
|
||||
// TODO proper error mapping
|
||||
Self::Inval
|
||||
}
|
||||
}
|
||||
|
||||
impl From<wiggle_runtime::GuestError> for Errno {
|
||||
fn from(err: wiggle_runtime::GuestError) -> Self {
|
||||
use wiggle_runtime::GuestError::*;
|
||||
impl From<wiggle::GuestError> for Errno {
|
||||
fn from(err: wiggle::GuestError) -> Self {
|
||||
use wiggle::GuestError::*;
|
||||
match err {
|
||||
InvalidFlagValue { .. } => Self::Inval,
|
||||
InvalidEnumValue { .. } => Self::Inval,
|
||||
@@ -83,7 +83,7 @@ pub(crate) trait AsBytes {
|
||||
impl AsBytes for types::Dirent {
|
||||
fn as_bytes(&self) -> Result<Vec<u8>> {
|
||||
use std::convert::TryInto;
|
||||
use wiggle_runtime::GuestType;
|
||||
use wiggle::GuestType;
|
||||
|
||||
assert_eq!(
|
||||
Self::guest_size(),
|
||||
|
||||
Reference in New Issue
Block a user