mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-26 00:00:20 +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);
|
/// assert_eq!(b.len(), 5);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn len(&self) -> usize {
|
pub const fn len(&self) -> usize {
|
||||||
self.len
|
self.len
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ impl Bytes {
|
|||||||
/// assert!(b.is_empty());
|
/// assert!(b.is_empty());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub const fn is_empty(&self) -> bool {
|
||||||
self.len == 0
|
self.len == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user