summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-08-26 20:16:52 +0200
committerHampusM <hampus@hampusmat.com>2024-08-26 20:16:52 +0200
commit0639ef032fd979762657eb48fea3f20cfc5ba1c2 (patch)
tree0707ff0df7aaad8950146730fa61d484d6783802 /src
parent0fc3ba4563895f5437faa2b20a5e93b615dbf25d (diff)
feat: add function to get if is empty
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5eb4439..fc92c3a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -127,6 +127,12 @@ where
self.capacity
}
+ /// Returns whether this `MultiVec` is empty.
+ pub fn is_empty(&self) -> bool
+ {
+ self.length == 0
+ }
+
fn grow_amortized(&mut self, additional: usize)
{
let required_cap = self.capacity.checked_add(additional).unwrap();