diff options
author | 2021-11-09 05:41:40 -0500 | |
---|---|---|
committer | 2021-11-09 11:41:40 +0100 | |
commit | d946ef2e91651a4d73a04b48715ecf0cde6db75d (patch) | |
tree | b8c905caf1ec0a93b63b1a9e6babcb2eb11a8132 /src | |
parent | ba5c5c93affe9386dd052c5236cad83057f9a81d (diff) | |
download | bytes-d946ef2e91651a4d73a04b48715ecf0cde6db75d.tar.gz bytes-d946ef2e91651a4d73a04b48715ecf0cde6db75d.tar.zst bytes-d946ef2e91651a4d73a04b48715ecf0cde6db75d.zip |
`const`-ify `Bytes::len` and `Bytes::is_empty` (#514)
Diffstat (limited to 'src')
-rw-r--r-- | src/bytes.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bytes.rs b/src/bytes.rs index d0be0d2..c4fbd4a 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -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 } |