mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-20 00:00:10 +02:00
inline Bytes::len and Bytes::is_empty (#211)
This commit is contained in:
committed by
Carl Lerche
parent
1ba5266bd9
commit
cdfd25f314
@@ -465,6 +465,7 @@ impl Bytes {
|
|||||||
/// let b = Bytes::from(&b"hello"[..]);
|
/// let b = Bytes::from(&b"hello"[..]);
|
||||||
/// assert_eq!(b.len(), 5);
|
/// assert_eq!(b.len(), 5);
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline]
|
||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.inner.len()
|
self.inner.len()
|
||||||
}
|
}
|
||||||
@@ -479,6 +480,7 @@ impl Bytes {
|
|||||||
/// let b = Bytes::new();
|
/// let b = Bytes::new();
|
||||||
/// assert!(b.is_empty());
|
/// assert!(b.is_empty());
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
self.inner.is_empty()
|
self.inner.is_empty()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user