@@ -108,7 +108,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
108108 /// assert_eq!(array.len(), 2);
109109 /// ```
110110 #[ inline( always) ]
111- pub fn len ( & self ) -> usize { self . len as usize }
111+ pub const fn len ( & self ) -> usize { self . len as usize }
112112
113113 /// Returns whether the `ArrayVec` is empty.
114114 ///
@@ -120,7 +120,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
120120 /// assert_eq!(array.is_empty(), true);
121121 /// ```
122122 #[ inline]
123- pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
123+ pub const fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
124124
125125 /// Return the capacity of the `ArrayVec`.
126126 ///
@@ -131,7 +131,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
131131 /// assert_eq!(array.capacity(), 3);
132132 /// ```
133133 #[ inline( always) ]
134- pub fn capacity ( & self ) -> usize { CAP }
134+ pub const fn capacity ( & self ) -> usize { CAP }
135135
136136 /// Return true if the `ArrayVec` is completely filled to its capacity, false otherwise.
137137 ///
@@ -143,7 +143,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
143143 /// array.push(1);
144144 /// assert!(array.is_full());
145145 /// ```
146- pub fn is_full ( & self ) -> bool { self . len ( ) == self . capacity ( ) }
146+ pub const fn is_full ( & self ) -> bool { self . len ( ) == self . capacity ( ) }
147147
148148 /// Returns the capacity left in the `ArrayVec`.
149149 ///
@@ -154,7 +154,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
154154 /// array.pop();
155155 /// assert_eq!(array.remaining_capacity(), 1);
156156 /// ```
157- pub fn remaining_capacity ( & self ) -> usize {
157+ pub const fn remaining_capacity ( & self ) -> usize {
158158 self . capacity ( ) - self . len ( )
159159 }
160160
0 commit comments