Implement IntoBuf for T: Buf

This commit is contained in:
Carl Lerche
2017-02-28 19:02:45 -08:00
parent f7f8d6c9ef
commit e842296c4d
+8
View File
@@ -47,6 +47,14 @@ pub trait IntoBuf {
fn into_buf(self) -> Self::Buf;
}
impl<T: Buf> IntoBuf for T {
type Buf = Self;
fn into_buf(self) -> Self {
self
}
}
impl<'a> IntoBuf for &'a [u8] {
type Buf = io::Cursor<&'a [u8]>;