ethereum-types `make it work in no_std` (#42)

* fix error on nightly

* make it work on no-std by disabling default ft
This commit is contained in:
Niklas Adolfsson 2018-07-05 11:33:17 +02:00 committed by Tomasz Drwięga
parent 94b28c822e
commit 5441e9fab2
4 changed files with 10 additions and 20 deletions

View File

@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/primitives"
[dependencies]
tiny-keccak = "1.4"
crunchy = { version = "0.1.6", features = ["limit_256"] }
fixed-hash = { version = "0.2.1", path = "../fixed-hash" }
fixed-hash = { version = "0.2.1", path = "../fixed-hash", default-features = false }
ethereum-types-serialize = { version = "0.2.1", path = "../serialize", optional = true }
serde = { version = "1.0", optional = true }

View File

@ -47,9 +47,12 @@ extern crate serde;
#[cfg(feature="serialize")]
use serde::{Serialize, Serializer, Deserialize, Deserializer};
use core::{ops, mem, str};
use core::{ops, mem};
use tiny_keccak::keccak256;
#[cfg(feature="std")]
use core::str;
// 3 according to yellowpaper
const BLOOM_BITS: u32 = 3;
const BLOOM_SIZE: usize = 256;

View File

@ -11,12 +11,12 @@ build = "build.rs"
rustc_version = "0.2"
[dependencies]
uint = { path = "../uint", version = "0.2.1" }
fixed-hash = { path = "../fixed-hash", version = "0.2" }
ethbloom = { path = "../ethbloom", version = "0.5.0" }
crunchy = "0.1.5"
ethbloom = { path = "../ethbloom", version = "0.5.0", default-features = false }
ethereum-types-serialize = { version = "0.2.1", path = "../serialize", optional = true }
fixed-hash = { path = "../fixed-hash", version = "0.2" }
serde = { version = "1.0", optional = true }
uint = { path = "../uint", version = "0.2.1", default-features = false }
[features]
default = ["std", "heapsizeof", "serialize"]

View File

@ -319,7 +319,7 @@ macro_rules! construct_hash {
}
}
#[cfg(feature="heapsizeof")]
#[cfg(all(feature="heapsizeof", feature="libc", not(target_os = "unknown")))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_heapsize_for_hash {
@ -332,7 +332,7 @@ macro_rules! impl_heapsize_for_hash {
}
}
#[cfg(not(feature="heapsizeof"))]
#[cfg(any(not(feature="heapsizeof"), not(feature="libc"), target_os = "unknown"))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_heapsize_for_hash {
@ -425,19 +425,6 @@ macro_rules! impl_std_for_hash_internals {
($from: ident, $size: tt) => {}
}
#[cfg(all(feature="libc", not(target_os = "unknown")))]
#[macro_export]
#[doc(hidden)]
macro_rules! impl_heapsize_for_hash {
($name: ident) => {
impl $crate::heapsize::HeapSizeOf for $name {
fn heap_size_of_children(&self) -> usize {
0
}
}
}
}
#[cfg(all(feature="libc", not(target_os = "unknown")))]
#[macro_export]
#[doc(hidden)]