openethereum/util/bloomchain/tests/util/from_hex.rs
Marek Kotewicz 66f3c50842 revert removing blooms (#8066)
* Revert "fix traces, removed bloomchain crate, closes #7228, closes #7167"

This reverts commit 1bf62038678295e5586f02a38a0c5aab9a9efe62.

* Revert "fixed broken logs (#7934)"

This reverts commit f8a2e53f3e.

* fixed broken logs

* bring back old lock order

* remove migration v13

* revert CURRENT_VERSION to 12 in migration.rs
2018-03-12 20:15:55 +00:00

17 lines
338 B
Rust

use rustc_hex::FromHex as RustcFromHex;
use bloomchain::Bloom;
pub trait FromHex {
fn from_hex(s: &str) -> Self where Self: Sized;
}
impl FromHex for Bloom {
fn from_hex(s: &str) -> Self {
let mut res = [0u8; 256];
let v = s.from_hex().unwrap();
assert_eq!(res.len(), v.len());
res.copy_from_slice(&v);
From::from(res)
}
}