diff --git a/src/map.rs b/src/map.rs index cd03ae8a..cb405caf 100644 --- a/src/map.rs +++ b/src/map.rs @@ -197,6 +197,11 @@ impl IndexMap { } } + /// Return the number of elements the map can hold without reallocating. + /// + /// This number is a lower bound; the map might be able to hold more, + /// but is guaranteed to be able to hold at least this many. + /// /// Computes in **O(1)** time. pub fn capacity(&self) -> usize { self.core.capacity() diff --git a/src/set.rs b/src/set.rs index 8e107594..dbee481f 100644 --- a/src/set.rs +++ b/src/set.rs @@ -176,6 +176,11 @@ impl IndexSet { } } + /// Return the number of elements the set can hold without reallocating. + /// + /// This number is a lower bound; the set might be able to hold more, + /// but is guaranteed to be able to hold at least this many. + /// /// Computes in **O(1)** time. pub fn capacity(&self) -> usize { self.map.capacity()