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:
parent
94b28c822e
commit
5441e9fab2
|
@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/primitives"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tiny-keccak = "1.4"
|
tiny-keccak = "1.4"
|
||||||
crunchy = { version = "0.1.6", features = ["limit_256"] }
|
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 }
|
ethereum-types-serialize = { version = "0.2.1", path = "../serialize", optional = true }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,12 @@ extern crate serde;
|
||||||
#[cfg(feature="serialize")]
|
#[cfg(feature="serialize")]
|
||||||
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
use serde::{Serialize, Serializer, Deserialize, Deserializer};
|
||||||
|
|
||||||
use core::{ops, mem, str};
|
use core::{ops, mem};
|
||||||
use tiny_keccak::keccak256;
|
use tiny_keccak::keccak256;
|
||||||
|
|
||||||
|
#[cfg(feature="std")]
|
||||||
|
use core::str;
|
||||||
|
|
||||||
// 3 according to yellowpaper
|
// 3 according to yellowpaper
|
||||||
const BLOOM_BITS: u32 = 3;
|
const BLOOM_BITS: u32 = 3;
|
||||||
const BLOOM_SIZE: usize = 256;
|
const BLOOM_SIZE: usize = 256;
|
||||||
|
|
|
@ -11,12 +11,12 @@ build = "build.rs"
|
||||||
rustc_version = "0.2"
|
rustc_version = "0.2"
|
||||||
|
|
||||||
[dependencies]
|
[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"
|
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 }
|
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 }
|
serde = { version = "1.0", optional = true }
|
||||||
|
uint = { path = "../uint", version = "0.2.1", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "heapsizeof", "serialize"]
|
default = ["std", "heapsizeof", "serialize"]
|
||||||
|
|
|
@ -319,7 +319,7 @@ macro_rules! construct_hash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature="heapsizeof")]
|
#[cfg(all(feature="heapsizeof", feature="libc", not(target_os = "unknown")))]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
macro_rules! impl_heapsize_for_hash {
|
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]
|
#[macro_export]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
macro_rules! impl_heapsize_for_hash {
|
macro_rules! impl_heapsize_for_hash {
|
||||||
|
@ -425,19 +425,6 @@ macro_rules! impl_std_for_hash_internals {
|
||||||
($from: ident, $size: tt) => {}
|
($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")))]
|
#[cfg(all(feature="libc", not(target_os = "unknown")))]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
Loading…
Reference in New Issue