mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-16 00:00:15 +02:00
Add convenience PartialEq for BytesMut and Bytes (#141)
Saves the cognitive load of having to wrap them in slices to compare them when that seems like what one would expect. Signed-off-by: Clint Byrum <[email protected]>
This commit is contained in:
@@ -2525,3 +2525,17 @@ impl<'a, T: ?Sized> PartialOrd<&'a T> for Bytes
|
||||
self.partial_cmp(&**other)
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<BytesMut> for Bytes
|
||||
{
|
||||
fn eq(&self, other: &BytesMut) -> bool {
|
||||
&other[..] == &self[..]
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<Bytes> for BytesMut
|
||||
{
|
||||
fn eq(&self, other: &Bytes) -> bool {
|
||||
&other[..] == &self[..]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user