Support compiling to WASM.

This commit is contained in:
Stephen Chung
2020-06-16 23:47:31 +08:00
parent 1adf3cc39a
commit 151cd1af48
7 changed files with 38 additions and 4 deletions

View File

@@ -24,6 +24,8 @@ use crate::stdlib::{
};
#[cfg(not(feature = "no_std"))]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm64"))]
use crate::stdlib::time::Instant;
/// Trait to represent any type.
@@ -192,6 +194,8 @@ impl Dynamic {
Union::Module(_) => "sub-scope",
#[cfg(not(feature = "no_std"))]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm64"))]
Union::Variant(value) if value.is::<Instant>() => "timestamp",
Union::Variant(value) => (***value).type_name(),
}
@@ -215,6 +219,8 @@ impl fmt::Display for Dynamic {
Union::Module(value) => fmt::Debug::fmt(value, f),
#[cfg(not(feature = "no_std"))]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm64"))]
Union::Variant(value) if value.is::<Instant>() => write!(f, "<timestamp>"),
Union::Variant(_) => write!(f, "?"),
}
@@ -238,6 +244,8 @@ impl fmt::Debug for Dynamic {
Union::Module(value) => fmt::Debug::fmt(value, f),
#[cfg(not(feature = "no_std"))]
#[cfg(not(target_arch = "wasm32"))]
#[cfg(not(target_arch = "wasm64"))]
Union::Variant(value) if value.is::<Instant>() => write!(f, "<timestamp>"),
Union::Variant(_) => write!(f, "<dynamic>"),
}