mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
Add IntoBuf impls for non-ref types
This commit is contained in:
@@ -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]>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user