File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ impl<A> ArrayString<A>
71
71
#[ inline]
72
72
pub fn len ( & self ) -> usize { self . len . to_usize ( ) }
73
73
74
+ /// Returns whether the string is empty.
75
+ #[ inline]
76
+ pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
77
+
74
78
/// Create a new `ArrayString` from a `str`.
75
79
///
76
80
/// Capacity is inferred from the type parameter.
Original file line number Diff line number Diff line change @@ -126,6 +126,18 @@ impl<A: Array> ArrayVec<A> {
126
126
#[ inline]
127
127
pub fn len ( & self ) -> usize { self . len . to_usize ( ) }
128
128
129
+ /// Returns whether the `ArrayVec` is empty.
130
+ ///
131
+ /// ```
132
+ /// use arrayvec::ArrayVec;
133
+ ///
134
+ /// let mut array = ArrayVec::from([1]);
135
+ /// array.pop();
136
+ /// assert_eq!(array.is_empty(), true);
137
+ /// ```
138
+ #[ inline]
139
+ pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
140
+
129
141
/// Return the capacity of the `ArrayVec`.
130
142
///
131
143
/// ```
You can’t perform that action at this time.
0 commit comments