inline Bytes::len and Bytes::is_empty (#211)

This commit is contained in:
Sean McArthur
2018-07-12 19:05:35 -07:00
committed by Carl Lerche
parent 1ba5266bd9
commit cdfd25f314
+2
View File
@@ -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()
} }