This commit is contained in:
Mikhail Borisov
2015-05-12 15:16:06 +03:00
parent 5fd9daa865
commit 5c631f3e58
2 changed files with 4 additions and 11 deletions
+3 -10
View File
@@ -78,10 +78,6 @@ impl ByteBuf {
bytes: Vec::with_capacity(cap) bytes: Vec::with_capacity(cap)
} }
} }
pub fn as_vec(self) -> Vec<u8> {
self.bytes
}
} }
impl fmt::Debug for ByteBuf { impl fmt::Debug for ByteBuf {
@@ -90,19 +86,16 @@ impl fmt::Debug for ByteBuf {
} }
} }
/*
// Disabled: triggers conflict with From implementation below
impl Into<Vec<u8>> for ByteBuf { impl Into<Vec<u8>> for ByteBuf {
fn into(self) -> Vec<u8> { fn into(self) -> Vec<u8> {
self.bytes self.bytes
} }
} }
*/
impl<T> From<T> for ByteBuf where T: Into<Vec<u8>> { impl From<Vec<u8>> for ByteBuf {
fn from(bytes: T) -> Self { fn from(bytes: Vec<u8>) -> Self {
ByteBuf { ByteBuf {
bytes: bytes.into(), bytes: bytes,
} }
} }
} }
+1 -1
View File
@@ -445,7 +445,7 @@ impl ValueDeserializer for bytes::ByteBuf
type Deserializer = ByteBufDeserializer; type Deserializer = ByteBufDeserializer;
fn into_deserializer(self) -> Self::Deserializer { fn into_deserializer(self) -> Self::Deserializer {
ByteBufDeserializer(Some(self.as_vec())) ByteBufDeserializer(Some(self.into()))
} }
} }