(v: &'a mut Vec<T>)
| 264 | #[cfg(feature = "alloc")] |
| 265 | #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))] |
| 266 | pub fn spare_capacity<'a, T>(v: &'a mut Vec<T>) -> SpareCapacity<'a, T> { |
| 267 | debug_assert_ne!( |
| 268 | v.capacity(), |
| 269 | 0, |
| 270 | "`extend` uses spare capacity, and never allocates new memory, so the `Vec` passed to it \ |
| 271 | should have some spare capacity." |
| 272 | ); |
| 273 | |
| 274 | SpareCapacity(v) |
| 275 | } |
| 276 | |
| 277 | #[cfg(feature = "alloc")] |
| 278 | impl<'a, T> private::Sealed<T> for SpareCapacity<'a, T> { |