Implement Borrow<[u8]> for ByteBuf types so they can be properly used in hashmaps
This commit is contained in:
parent
1414a28aaf
commit
8dc8c1e35d
3 changed files with 20 additions and 17 deletions
|
|
@ -131,6 +131,18 @@ impl std::convert::AsRef<[u8]> for ByteBufOwned {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::borrow::Borrow<[u8]> for ByteBufOwned {
|
||||
fn borrow(&self) -> &[u8] {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> std::borrow::Borrow<[u8]> for ByteBuf<'a> {
|
||||
fn borrow(&self) -> &[u8] {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> std::ops::Deref for ByteBuf<'a> {
|
||||
type Target = [u8];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue