From c65213f5b8b74f2ab149f6fe216eac11d474e68e Mon Sep 17 00:00:00 2001 From: boondockenergy Date: Tue, 25 Mar 2025 15:51:36 -0700 Subject: [PATCH] Make BitArray len() and is_empty() const --- src/array.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/array.rs b/src/array.rs index d5f0a939..fb99defa 100644 --- a/src/array.rs +++ b/src/array.rs @@ -4,10 +4,7 @@ use core::marker::PhantomData; use crate::{ mem, - order::{ - BitOrder, - Lsb0, - }, + order::{BitOrder, Lsb0}, slice::BitSlice, view::BitViewSized, }; @@ -104,7 +101,7 @@ where /// /// This method is a compile-time constant. #[inline] - pub fn len(&self) -> usize { + pub const fn len(&self) -> usize { mem::bits_of::() } @@ -112,7 +109,7 @@ where /// /// This method is a compile-time constant. #[inline] - pub fn is_empty(&self) -> bool { + pub const fn is_empty(&self) -> bool { mem::bits_of::() == 0 } }