diff --git a/src/lib.rs b/src/lib.rs index 9100e08..7103cf1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ extern crate byteorder; use std::fmt; use std::error; -use parity_wasm::elements::{FunctionType, ValueType}; /// Internal interpreter error. #[derive(Debug)] @@ -98,32 +97,7 @@ impl From<::common::stack::Error> for Error { } } -#[derive(Debug, Clone, PartialEq)] -pub struct Signature { - func_type: FunctionType, -} - -impl Signature { - pub fn new(params: &[ValueType], return_type: Option) -> Signature { - Signature { - func_type: FunctionType::new(params.to_vec(), return_type), - } - } - - pub fn params(&self) -> &[ValueType] { - self.func_type.params() - } - - pub fn return_type(&self) -> Option { - self.func_type.return_type() - } -} - -impl From for Signature { - fn from(func_type: FunctionType) -> Signature { - Signature { func_type } - } -} +use types::Signature; mod validation; mod common; @@ -136,6 +110,7 @@ mod host; mod imports; mod global; mod func; +mod types; #[cfg(test)] mod tests; diff --git a/src/types.rs b/src/types.rs new file mode 100644 index 0000000..5fefceb --- /dev/null +++ b/src/types.rs @@ -0,0 +1,28 @@ +use parity_wasm::elements::{FunctionType, ValueType}; + +#[derive(Debug, Clone, PartialEq)] +pub struct Signature { + func_type: FunctionType, +} + +impl Signature { + pub fn new(params: &[ValueType], return_type: Option) -> Signature { + Signature { + func_type: FunctionType::new(params.to_vec(), return_type), + } + } + + pub fn params(&self) -> &[ValueType] { + self.func_type.params() + } + + pub fn return_type(&self) -> Option { + self.func_type.return_type() + } +} + +impl From for Signature { + fn from(func_type: FunctionType) -> Signature { + Signature { func_type } + } +}