Implement Debug for the various ByteBuf types

This commit is contained in:
Florian Hartwig
2015-09-25 09:47:46 -07:00
committed by Carl Lerche
parent a76dd8ed0e
commit 01c1e05a91
+19 -1
View File
@@ -1,6 +1,6 @@
use {alloc, Bytes, SeqByteStr, MAX_CAPACITY};
use traits::{Buf, MutBuf, MutBufExt, ByteStr};
use std::{cmp, ptr};
use std::{cmp, fmt, ptr};
/*
*
@@ -188,6 +188,12 @@ impl Buf for ByteBuf {
}
}
impl fmt::Debug for ByteBuf {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.bytes().fmt(fmt)
}
}
/*
*
* ===== ROByteBuf =====
@@ -254,6 +260,12 @@ impl Buf for ROByteBuf {
}
}
impl fmt::Debug for ROByteBuf {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.bytes().fmt(fmt)
}
}
/*
*
* ===== MutByteBuf =====
@@ -327,3 +339,9 @@ impl MutBuf for MutByteBuf {
&mut self.buf.mem.bytes_mut()[pos..lim]
}
}
impl fmt::Debug for MutByteBuf {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
self.bytes().fmt(fmt)
}
}