mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 11:37:55 +00:00
WIP
This commit is contained in:
+3
-10
@@ -78,10 +78,6 @@ impl ByteBuf {
|
||||
bytes: Vec::with_capacity(cap)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_vec(self) -> Vec<u8> {
|
||||
self.bytes
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
fn into(self) -> Vec<u8> {
|
||||
self.bytes
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
impl<T> From<T> for ByteBuf where T: Into<Vec<u8>> {
|
||||
fn from(bytes: T) -> Self {
|
||||
impl From<Vec<u8>> for ByteBuf {
|
||||
fn from(bytes: Vec<u8>) -> Self {
|
||||
ByteBuf {
|
||||
bytes: bytes.into(),
|
||||
bytes: bytes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -445,7 +445,7 @@ impl ValueDeserializer for bytes::ByteBuf
|
||||
type Deserializer = ByteBufDeserializer;
|
||||
|
||||
fn into_deserializer(self) -> Self::Deserializer {
|
||||
ByteBufDeserializer(Some(self.as_vec()))
|
||||
ByteBufDeserializer(Some(self.into()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user