Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion triehash/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog].
[Keep a Changelog]: http://keepachangelog.com/en/1.0.0/

## [Unreleased]

- Added no-std support (https://github.com/paritytech/parity-common/pull/280)
## [0.8.1] - 2019-10-24
- Migrated to 2018 edition (https://github.com/paritytech/parity-common/pull/214)
### Dependencies
Expand Down
13 changes: 10 additions & 3 deletions triehash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "triehash"
version = "0.8.1"
version = "0.8.2"
authors = ["Parity Technologies <admin@parity.io>"]
description = "In-memory patricia trie operations"
repository = "https://github.com/paritytech/parity-common"
license = "GPL-3.0"
edition = "2018"

[dependencies]
hash-db = "0.15.2"
rlp = { version = "0.4", path = "../rlp" }
hash-db = { version = "0.15.2", default-features = false }
rlp = { version = "0.4", path = "../rlp", default-features = false }

[dev-dependencies]
criterion = "0.3.0"
Expand All @@ -19,6 +19,13 @@ tiny-keccak = { version = "2.0", features = ["keccak"] }
trie-standardmap = "0.15.2"
hex-literal = "0.2.1"

[features]
default = ["std"]
std = [
"hash-db/std",
"rlp/std",
]

[[bench]]
name = "triehash"
path = "benches/triehash.rs"
Expand Down
23 changes: 20 additions & 3 deletions triehash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,26 @@
//!
//! This module should be used to generate trie root hash.

use std::cmp;
use std::collections::BTreeMap;
use std::iter::once;
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;

#[cfg(feature = "std")]
mod rstd {
pub use std::collections::BTreeMap;
}

#[cfg(not(feature = "std"))]
mod rstd {
pub use alloc::vec::Vec;
pub use alloc::collections::BTreeMap;
}

use core::cmp;
use core::iter::once;
use rstd::*;


use hash_db::Hasher;
use rlp::RlpStream;
Expand Down