mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-18 16:24:29 -04:00
inline Bytes::len and Bytes::is_empty (#211)
This commit is contained in:
committed by
Carl Lerche
parent
26b507855e
commit
fbb7272cba
@@ -465,6 +465,7 @@ impl Bytes {
|
||||
/// let b = Bytes::from(&b"hello"[..]);
|
||||
/// assert_eq!(b.len(), 5);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn len(&self) -> usize {
|
||||
self.inner.len()
|
||||
}
|
||||
@@ -479,6 +480,7 @@ impl Bytes {
|
||||
/// let b = Bytes::new();
|
||||
/// assert!(b.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.inner.is_empty()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user