mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-25 07:25:26 -04: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