mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
const-ify Bytes::len and Bytes::is_empty (#514)
This commit is contained in:
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user