1extern crate ethereum_types;
16extern crate plain_hasher;
17
18use std::collections::{HashMap, HashSet};
19use std::hash;
20
21pub mod traits;
22
23pub use ethereum_types::{Bloom, BloomInput, BloomRef};
24pub use ethereum_types::{H128, H160, H256, H264, H32, H512, H520, H64};
25pub use ethereum_types::{U128, U256, U512, U64};
26pub use plain_hasher::PlainHasher;
27
28pub type Address = H160;
29
30pub type H256FastMap<T> = HashMap<H256, T, hash::BuildHasherDefault<PlainHasher>>;
32pub type H256FastSet = HashSet<H256, hash::BuildHasherDefault<PlainHasher>>;
34
35#[inline]
36pub fn pad_left0(hexstr: &str, width: usize) -> String {
37 format!("{:0>width$}", hexstr, width = width)
38}
39
40#[inline]
41pub fn delete_left0(s: &str) -> &str {
42 let mut cnt = 0;
43 for i in s.chars() {
44 if i == '0' {
45 cnt += 1;
46 } else {
47 break;
48 }
49 }
50 &s[cnt..]
51}
52
53#[inline]
54pub fn clean_0x(s: &str) -> &str {
55 if let Some(stripped) = s.strip_prefix("0x") {
56 stripped
57 } else {
58 s
59 }
60}