diff --git a/src/lib.rs b/src/lib.rs index ea24aed..4ba40a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -664,6 +664,11 @@ impl ThinVec { self.header().cap() } + /// Returns `true` if the vector has the capacity to hold any element. + pub fn has_capacity(&self) -> bool { + !self.is_singleton() + } + /// Forces the length of the vector to `new_len`. /// /// This is a low-level operation that maintains none of the normal