MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / spare_capacity

Function spare_capacity

src/buffer.rs:266–275  ·  view source on GitHub ↗
(v: &'a mut Vec<T>)

Source from the content-addressed store, hash-verified

264#[cfg(feature = "alloc")]
265#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
266pub 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")]
278impl<'a, T> private::Sealed<T> for SpareCapacity<'a, T> {

Callers 7

test_compilationFunction · 0.85
test_spare_capacityFunction · 0.85
serverFunction · 0.85
epoll_timeout_nsecsFunction · 0.85
epoll_timeout_secsFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

SpareCapacityClass · 0.85

Tested by 4

test_compilationFunction · 0.68
test_spare_capacityFunction · 0.68
epoll_timeout_nsecsFunction · 0.68
epoll_timeout_secsFunction · 0.68