Introduce hex/string printing in runtime.

This commit is contained in:
Gav
2018-01-27 13:42:40 +01:00
parent ace1387076
commit d97520c7f0
10 changed files with 34 additions and 12 deletions
+8 -3
View File
@@ -40,6 +40,7 @@ pub mod prelude {
}
pub use polkadot_state_machine::{Externalities, ExternalitiesError};
use primitives::hexdisplay::HexDisplay;
// TODO: use the real error, not NoError.
@@ -111,9 +112,13 @@ pub trait Printable {
impl<'a> Printable for &'a [u8] {
fn print(self) {
if let Ok(s) = ::std::str::from_utf8(self) {
println!("Runtime: {}", s);
}
println!("Runtime: {}", HexDisplay::from(&self));
}
}
impl<'a> Printable for &'a str {
fn print(self) {
println!("Runtime: {}", self);
}
}