Add IntoBuf impls for non-ref types

This commit is contained in:
Carl Lerche
2016-10-07 14:27:26 -07:00
parent e00c08c6c7
commit 6f97d04077
+16
View File
@@ -399,6 +399,14 @@ impl<'a> IntoBuf for &'a &'static [u8] {
}
}
impl IntoBuf for Vec<u8> {
type Buf = io::Cursor<Vec<u8>>;
fn into_buf(self) -> Self::Buf {
io::Cursor::new(self)
}
}
impl<'a> IntoBuf for &'a Vec<u8> {
type Buf = io::Cursor<&'a [u8]>;
@@ -407,6 +415,14 @@ impl<'a> IntoBuf for &'a Vec<u8> {
}
}
impl IntoBuf for () {
type Buf = io::Cursor<&'static [u8]>;
fn into_buf(self) -> Self::Buf {
io::Cursor::new(&[])
}
}
impl<'a> IntoBuf for &'a () {
type Buf = io::Cursor<&'static [u8]>;