From ed4f7a113073c08cba9020c3f0dd6c8f0441f857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 12 Aug 2020 21:35:10 +0200 Subject: [PATCH] Make `HexDisplay` useable in `no_std` (#6883) Actually I use this quite often when debugging some WASM bugs and there is no harm in enabling it by default. Before I just always copied it everytime I needed it. --- primitives/core/src/hexdisplay.rs | 3 ++- primitives/core/src/lib.rs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/primitives/core/src/hexdisplay.rs b/primitives/core/src/hexdisplay.rs index f4c8fea8f2223..9d2b7a12d032e 100644 --- a/primitives/core/src/hexdisplay.rs +++ b/primitives/core/src/hexdisplay.rs @@ -67,7 +67,7 @@ impl AsBytesRef for [u8] { fn as_bytes_ref(&self) -> &[u8] { &self } } -impl AsBytesRef for Vec { +impl AsBytesRef for sp_std::vec::Vec { fn as_bytes_ref(&self) -> &[u8] { &self } } @@ -84,6 +84,7 @@ impl_non_endians!([u8; 1], [u8; 2], [u8; 3], [u8; 4], [u8; 5], [u8; 6], [u8; 7], [u8; 48], [u8; 56], [u8; 64], [u8; 65], [u8; 80], [u8; 96], [u8; 112], [u8; 128]); /// Format into ASCII + # + hex, suitable for storage key preimages. +#[cfg(feature = "std")] pub fn ascii_format(asciish: &[u8]) -> String { let mut r = String::new(); let mut latch = false; diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 7e52efd52e9f6..c8a289639d4f2 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -52,7 +52,6 @@ pub use impl_serde::serialize as bytes; pub mod hashing; #[cfg(feature = "full_crypto")] pub use hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256, keccak_256}; -#[cfg(feature = "std")] pub mod hexdisplay; pub mod crypto;