mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-26 00:00:20 +02:00
Impl FromIterator<&'a u8> for BytesMut/Bytes (#244)
This commit is contained in:
@@ -926,6 +926,18 @@ impl FromIterator<u8> for Bytes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> FromIterator<&'a u8> for BytesMut {
|
||||||
|
fn from_iter<T: IntoIterator<Item = &'a u8>>(into_iter: T) -> Self {
|
||||||
|
BytesMut::from_iter(into_iter.into_iter().map(|b| *b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> FromIterator<&'a u8> for Bytes {
|
||||||
|
fn from_iter<T: IntoIterator<Item = &'a u8>>(into_iter: T) -> Self {
|
||||||
|
BytesMut::from_iter(into_iter).freeze()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq for Bytes {
|
impl PartialEq for Bytes {
|
||||||
fn eq(&self, other: &Bytes) -> bool {
|
fn eq(&self, other: &Bytes) -> bool {
|
||||||
self.inner.as_ref() == other.inner.as_ref()
|
self.inner.as_ref() == other.inner.as_ref()
|
||||||
|
|||||||
Reference in New Issue
Block a user