From 0639ef032fd979762657eb48fea3f20cfc5ba1c2 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 26 Aug 2024 20:16:52 +0200 Subject: feat: add function to get if is empty --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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(); -- cgit v1.2.3-18-g5258