Open vadixidav opened 6 years ago
I do this in my code currently by abusing the fact that the macros don't trait bound:
// Not using HexDisplay in this scope.
trait DbgFakeHex {
fn to_hex(&self, chunk_size: usize) -> String;
}
impl DbgFakeHex for str {
fn to_hex(&self, chunk_size: usize) -> String {
use nom::HexDisplay;
self.as_bytes().to_hex(chunk_size)
}
}
This would still be useful...
Currently dbg_dmp!() only works for &[u8]. It could easily be adapted to work for strings.
I recommend using str::as_bytes() to get the bytes and hex dump the bytes of the string in the HexDisplay trait impl.