Reimplement fmt::Debug for Bytes and BytesMut (#84)

Standard `Debug` implementation for `[u8]` is comma separated list
of numbers. Since large amount of byte strings are in fact ASCII
strings or contain a lot of ASCII strings (e. g. HTTP), it is
convenient to print strings as ASCII when possible.
This commit is contained in:
Stepan Koltsov
2017-03-20 21:09:44 -07:00
committed by Carl Lerche
parent dc9c8e304e
commit 613d4bd5d5
5 changed files with 80 additions and 3 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ fn from_slice() {
#[test]
fn fmt() {
let a = format!("{:?}", Bytes::from(&b"abcdefg"[..]));
let b = format!("{:?}", b"abcdefg");
let b = "b\"abcdefg\"";
assert_eq!(a, b);