const-ify Bytes::len and Bytes::is_empty (#514)

This commit is contained in:
Cyborus04
2021-11-09 11:41:40 +01:00
committed by GitHub
parent ba5c5c93af
commit d946ef2e91
+2 -2
View File
@@ -179,7 +179,7 @@ impl Bytes {
/// assert_eq!(b.len(), 5);
/// ```
#[inline]
pub fn len(&self) -> usize {
pub const fn len(&self) -> usize {
self.len
}
@@ -194,7 +194,7 @@ impl Bytes {
/// assert!(b.is_empty());
/// ```
#[inline]
pub fn is_empty(&self) -> bool {
pub const fn is_empty(&self) -> bool {
self.len == 0
}