From 761e7bb5f5b320853a8e06ef6b857dadb44cb2ea Mon Sep 17 00:00:00 2001 From: Jake Lang Date: Sat, 26 Jan 2019 22:00:06 -0500 Subject: [PATCH] Add type conversion traits in case no_std is enabled --- src/convert.rs | 9 +++++++++ src/lib.rs | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/convert.rs diff --git a/src/convert.rs b/src/convert.rs new file mode 100644 index 0000000..4c49458 --- /dev/null +++ b/src/convert.rs @@ -0,0 +1,9 @@ +use super::*; + +pub trait From: Sized { + fn from(_: T) -> Self; +} + +pub trait Into: Sized { + fn from(self) -> T; +} diff --git a/src/lib.rs b/src/lib.rs index ea47800..b21286f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#[cfg(not(feature = "std"))] +pub mod convert; /// ewasm_api is a library used to interface with Ethereum's EEI in Ewasm, a set of enhancements to /// the Ethereum smart contract platform. /// ewasm_api exposes both a set of unsafe "native" functions representing the actual EEI @@ -18,7 +20,6 @@ /// finish_data(&a.bytes); /// } /// ``` - pub mod types; mod native;