Skip to content

Commit

Permalink
Make HexDisplay useable in no_std (paritytech#6883)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bkchr authored Aug 12, 2020
1 parent 473a23f commit ed4f7a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion primitives/core/src/hexdisplay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl AsBytesRef for [u8] {
fn as_bytes_ref(&self) -> &[u8] { &self }
}

impl AsBytesRef for Vec<u8> {
impl AsBytesRef for sp_std::vec::Vec<u8> {
fn as_bytes_ref(&self) -> &[u8] { &self }
}

Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion primitives/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ed4f7a1

Please sign in to comment.