mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-28 13:00:26 +00:00
Added is_full to LinearMap
This commit is contained in:
parent
f6b94876b9
commit
c603323c23
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Added `is_full` to `BinaryHeap`
|
||||
- Added `is_full` to `IndexMap`
|
||||
- Added `is_full` to `IndexSet`
|
||||
- Added `is_full` to `LinearMap`
|
||||
- Added infallible conversions from arrays to `Vec`.
|
||||
- Added `Vec::spare_capacity_mut`.
|
||||
- Added `Extend` impls for `Deque`.
|
||||
|
@ -227,6 +227,27 @@ where
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Returns true if the map is full.
|
||||
///
|
||||
/// Computes in *O*(1) time.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use heapless::LinearMap;
|
||||
///
|
||||
/// let mut a: LinearMap<_, _, 4> = LinearMap::new();
|
||||
/// assert!(!a.is_full());
|
||||
/// a.insert(1, "a").unwrap();
|
||||
/// a.insert(2, "b").unwrap();
|
||||
/// a.insert(3, "c").unwrap();
|
||||
/// a.insert(4, "d").unwrap();
|
||||
/// assert!(a.is_full());
|
||||
/// ```
|
||||
pub fn is_full(&self) -> bool {
|
||||
self.len() == self.capacity()
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order.
|
||||
///
|
||||
/// # Examples
|
||||
|
Loading…
x
Reference in New Issue
Block a user