mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 16:41:01 +00:00
WIP
This commit is contained in:
+3
-10
@@ -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
@@ -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()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user