feat(interface-types) Move the values and serde modules to the root of the crate.

This commit is contained in:
Ivan Enderlin 2020-04-09 11:23:26 +02:00
parent de1d3c7766
commit 81bb278b4c
13 changed files with 27 additions and 27 deletions

View File

@ -6,7 +6,7 @@ mod strings;
use crate::{
errors::{InstructionError, InstructionErrorKind, InstructionResult, WasmValueNativeCastError},
interpreter::wasm::values::{InterfaceValue, NativeType},
values::{InterfaceValue, NativeType},
};
pub(crate) use argument_get::argument_get;
pub(crate) use call_core::call_core;
@ -163,11 +163,7 @@ where
#[cfg(test)]
pub(crate) mod tests {
use crate::{
ast::*,
interpreter::wasm::{self, values::InterfaceValue},
types::*,
};
use crate::{ast::*, interpreter::wasm, types::*, values::*};
use std::{cell::Cell, collections::HashMap, convert::TryInto, ops::Deref, rc::Rc};
pub(crate) struct Export {

View File

@ -1,7 +1,8 @@
use crate::{
errors::{InstructionError, InstructionErrorKind},
interpreter::{wasm::values::InterfaceValue, Instruction},
interpreter::Instruction,
types::InterfaceType,
values::InterfaceValue,
};
use std::convert::TryInto;

View File

@ -1,13 +1,12 @@
use crate::{
ast::{Type, TypeKind},
errors::{InstructionError, InstructionErrorKind},
interpreter::wasm::values::FlattenInterfaceValueIterator,
interpreter::{
stack::{Stack, Stackable},
wasm::values::InterfaceValue,
Instruction,
},
types::{InterfaceType, RecordType},
values::{FlattenInterfaceValueIterator, InterfaceValue},
};
use std::collections::VecDeque;
@ -176,10 +175,10 @@ mod tests {
interpreter::{
instructions::tests::{Export, Instance, LocalImport, Memory, MemoryView},
stack::Stackable,
wasm::values::{from_interface_values, InterfaceValue},
Instruction, Interpreter,
},
types::InterfaceType,
values::{from_interface_values, InterfaceValue},
};
use serde::Deserialize;
use std::{cell::Cell, collections::HashMap, convert::TryInto};

View File

@ -1,8 +1,9 @@
use super::to_native;
use crate::{
errors::{InstructionError, InstructionErrorKind},
interpreter::{wasm::values::InterfaceValue, Instruction},
interpreter::Instruction,
types::InterfaceType,
values::InterfaceValue,
};
use std::{cell::Cell, convert::TryInto};

View File

@ -4,11 +4,13 @@ mod instructions;
pub mod stack;
pub mod wasm;
use crate::errors::{InstructionResult, InterpreterResult};
use crate::{
errors::{InstructionResult, InterpreterResult},
values::InterfaceValue,
};
pub use instructions::Instruction;
use stack::Stack;
use std::{convert::TryFrom, marker::PhantomData};
use wasm::values::InterfaceValue;
/// Represents the `Runtime`, which is used by an adapter to execute
/// its instructions.

View File

@ -2,8 +2,4 @@
//! types, and traits —basically this is the part a runtime should
//! take a look to use the `wasmer-interface-types` crate—.
#[cfg(feature = "serde")]
mod serde;
pub mod structures;
pub mod values;

View File

@ -1,6 +1,6 @@
#![allow(missing_docs)]
use crate::{ast, interpreter::wasm::values::InterfaceValue, types::InterfaceType};
use crate::{ast, types::InterfaceType, values::InterfaceValue};
use std::{cell::Cell, ops::Deref};
pub trait TypedIndex: Copy + Clone {

View File

@ -58,4 +58,7 @@ pub mod decoders;
pub mod encoders;
pub mod errors;
pub mod interpreter;
#[cfg(feature = "serde")]
mod serde;
pub mod values;
pub mod vec1;

View File

@ -100,10 +100,10 @@ macro_rules! test_executable_instruction {
interpreter::{
instructions::tests::{Export, Instance, LocalImport, Memory, MemoryView},
stack::Stackable,
wasm::values::InterfaceValue,
Instruction, Interpreter,
},
types::InterfaceType,
values::InterfaceValue,
};
use std::{cell::Cell, collections::HashMap, convert::TryInto};
@ -142,10 +142,10 @@ macro_rules! test_executable_instruction {
interpreter::{
instructions::tests::{Export, Instance, LocalImport, Memory, MemoryView},
stack::Stackable,
wasm::values::InterfaceValue,
Instruction, Interpreter,
},
types::InterfaceType,
values::InterfaceValue,
};
use std::{cell::Cell, collections::HashMap, convert::TryInto};

View File

@ -1,8 +1,8 @@
//! Provides a deserializer from WIT values to Rust value.
use crate::{
interpreter::wasm::values::{FlattenInterfaceValueIterator, InterfaceValue},
types::InterfaceType,
values::{FlattenInterfaceValueIterator, InterfaceValue},
};
use serde::{de, Deserialize};
use std::{
@ -20,7 +20,7 @@ use std::{
/// # Example
///
/// ```rust
/// use wasmer_interface_types::interpreter::wasm::values::{
/// use wasmer_interface_types::values::{
/// InterfaceValue,
/// from_interface_values,
/// };

View File

@ -1,6 +1,6 @@
//! Provides a serializer from Rust value to WIT values.
use crate::interpreter::wasm::values::InterfaceValue;
use crate::values::InterfaceValue;
use serde::{ser, Serialize};
use std::fmt::{self, Display};
@ -13,7 +13,7 @@ use std::fmt::{self, Display};
/// # Example
///
/// ```rust
/// use wasmer_interface_types::interpreter::wasm::values::{
/// use wasmer_interface_types::values::{
/// InterfaceValue,
/// to_interface_value,
/// };

View File

@ -1,11 +1,13 @@
//! Defines WIT values and associated operations.
use crate::types::{InterfaceType, RecordType};
use crate::{errors::WasmValueNativeCastError, vec1::Vec1};
use crate::{
types::{InterfaceType, RecordType},
{errors::WasmValueNativeCastError, vec1::Vec1},
};
use std::{convert::TryFrom, slice::Iter};
#[cfg(feature = "serde")]
pub use crate::interpreter::wasm::serde::{de::*, ser::*};
pub use crate::serde::{de::from_interface_values, ser::to_interface_value};
/// A WIT value.
#[derive(Debug, Clone, PartialEq)]