File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
15
15
- Added ` is_full ` to ` BinaryHeap `
16
16
- Added ` is_full ` to ` IndexMap `
17
17
- Added ` is_full ` to ` IndexSet `
18
+ - Added ` is_full ` to ` LinearMap `
18
19
- Added infallible conversions from arrays to ` Vec ` .
19
20
- Added ` Vec::spare_capacity_mut ` .
20
21
- Added ` Extend ` impls for ` Deque ` .
Original file line number Diff line number Diff line change @@ -227,6 +227,27 @@ where
227
227
self . len ( ) == 0
228
228
}
229
229
230
+ /// Returns true if the map is full.
231
+ ///
232
+ /// Computes in *O*(1) time.
233
+ ///
234
+ /// # Examples
235
+ ///
236
+ /// ```
237
+ /// use heapless::LinearMap;
238
+ ///
239
+ /// let mut a: LinearMap<_, _, 4> = LinearMap::new();
240
+ /// assert!(!a.is_full());
241
+ /// a.insert(1, "a").unwrap();
242
+ /// a.insert(2, "b").unwrap();
243
+ /// a.insert(3, "c").unwrap();
244
+ /// a.insert(4, "d").unwrap();
245
+ /// assert!(a.is_full());
246
+ /// ```
247
+ pub fn is_full ( & self ) -> bool {
248
+ self . len ( ) == self . capacity ( )
249
+ }
250
+
230
251
/// An iterator visiting all key-value pairs in arbitrary order.
231
252
///
232
253
/// # Examples
You can’t perform that action at this time.
0 commit comments