···5566- Minimal Supported Rust Version is now 1.82
77- `fn remove` is implemented
88+- `fn fill` is implemented
99+- `fn remove_all` is implemented
1010+- `fn clear` is **deprecated**
811- `fn push_within_capacity` is implemented
912- `.skip(n)` on our iterators is now O(1) instead of O(n) time
1013- `fn to_bytes` is optimized with a lookup table
+24
src/lib.rs
···18571857 result
18581858 }
1859185918601860+ /// Removes all bits in this vector.
18611861+ ///
18621862+ /// Note: this method is not named [`clear`] to avoid confusion whenever [`.fill(false)`]
18631863+ /// is needed.
18641864+ ///
18651865+ /// [`clear`]: Self::clear
18661866+ /// [`.fill(false)`]: Self::fill
18671867+ pub fn remove_all(&mut self) {
18681868+ self.storage.clear();
18691869+ self.nbits = 0;
18701870+ }
18711871+18601872 /// Appends an element if there is sufficient spare capacity, otherwise an error is returned
18611873 /// with the element.
18621874 ///
···35423554 assert_eq!(v.remove(1024), 1024 % 11 < 7);
35433555 assert_eq!(v.len(), 1024);
35443556 assert_eq!(v.storage().len(), 1024 / 32);
35573557+ }
35583558+35593559+ #[test]
35603560+ fn test_remove_all() {
35613561+ let mut v = BitVec::from_elem(1024, false);
35623562+ for _ in 0..1024 {
35633563+ let mut v2 = v.clone();
35643564+ v2.remove_all();
35653565+ assert_eq!(v2.len(), 0);
35663566+ assert_eq!(v2.get(0), None);
35673567+ assert_eq!(v2, BitVec::new());
35683568+ }
35453569 }
35463570}