feat(interface-types) Make serde optional behind a feature flag.

This commit is contained in:
Ivan Enderlin 2020-04-02 13:53:10 +02:00
parent dc87c44d52
commit d8c4d8fa83
4 changed files with 14 additions and 2 deletions

View File

@ -10,4 +10,11 @@ edition = "2018"
[dependencies]
nom = "5.1"
wast = "8.0"
serde = { version = "1.0", features = ["derive"] }
# `serde` is useful only to simplify the users' life. It is not
# required by WIT itself, is is used to transform WIT values like
# `record`s to Rust sum types.
serde = { version = "1.0", features = ["derive"], optional = true }
[features]
default = ["serde"]

View File

@ -214,6 +214,7 @@ mod tests {
])],
);
#[cfg(feature = "serde")]
#[test]
#[allow(non_snake_case, unused)]
fn test_record_lift__to_rust_struct() {

View File

@ -2,6 +2,8 @@
//! 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

@ -2,9 +2,11 @@
pub use crate::ast::{InterfaceType, RecordType};
use crate::errors::WasmValueNativeCastError;
pub use crate::interpreter::wasm::serde::*;
use std::{convert::TryFrom, slice::Iter};
#[cfg(feature = "serde")]
pub use crate::interpreter::wasm::serde::*;
/// A WIT value.
#[derive(Debug, Clone, PartialEq)]
pub enum InterfaceValue {