Shorten ByteBuf trait bounds everywhere
This commit is contained in:
parent
c7b7dc300f
commit
9d1ef5c35c
6 changed files with 35 additions and 27 deletions
|
|
@ -3,8 +3,10 @@
|
|||
//
|
||||
// Not useful outside of librqbit.
|
||||
|
||||
use std::borrow::Borrow;
|
||||
|
||||
use bytes::Bytes;
|
||||
use serde::{Deserialize, Deserializer};
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
|
||||
use clone_to_owned::CloneToOwned;
|
||||
|
||||
|
|
@ -15,7 +17,9 @@ pub struct ByteBufOwned(pub bytes::Bytes);
|
|||
#[serde(transparent)]
|
||||
pub struct ByteBuf<'a>(pub &'a [u8]);
|
||||
|
||||
pub trait ByteBufT {
|
||||
pub trait ByteBufT:
|
||||
AsRef<[u8]> + std::hash::Hash + Serialize + Eq + core::fmt::Debug + CloneToOwned + Borrow<[u8]>
|
||||
{
|
||||
fn as_slice(&self) -> &[u8];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue