openethereum/util/json-tests/src/util.rs

9 lines
176 B
Rust
Raw Normal View History

2015-12-03 05:44:35 +01:00
use rustc_serialize::hex::FromHex;
pub fn hex_or_string(s: &str) -> Vec<u8> {
match s.starts_with("0x") {
true => s[2..].from_hex().unwrap(),
false => From::from(s)
}
}