Skip to content

Commit 1b79c91

Browse files
authored
Merge pull request #46 from Zoxc/has_cap
Add `has_capacity` as a proxy for `is_singleton`
2 parents b9e3de0 + d9c0cd6 commit 1b79c91

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ impl<T> ThinVec<T> {
666666
self.header().cap()
667667
}
668668

669+
/// Returns `true` if the vector has the capacity to hold any element.
670+
pub fn has_capacity(&self) -> bool {
671+
!self.is_singleton()
672+
}
673+
669674
/// Forces the length of the vector to `new_len`.
670675
///
671676
/// This is a low-level operation that maintains none of the normal

0 commit comments

Comments
 (0)