Lines Matching defs:elements

105 /// capacity of the vector (the number of elements that currently fit into the vector), its length
106 /// (the number of elements that are currently stored in the vector) and the `Allocator` type used
112 /// [`Vec`]'s backing buffer gets, if required, automatically increased (re-allocated) when elements
120 /// - `self.len` always represents the exact number of elements stored in the vector.
122 /// - `self.layout` represents the absolute number of elements that can be stored within the vector
135 /// elements we can still store without reallocating.
180 // SAFETY: `Vec` is `Send` if `T` is `Send` because `Vec` owns its elements.
188 // SAFETY: `Vec` is `Sync` if `T` is `Sync` because `Vec` owns its elements.
205 /// Returns the number of elements that can be stored within the vector without allocating
215 /// Returns the number of elements stored within the vector.
226 /// - All elements within the interval [`self.len`,`self.len + additional`) must be initialized.
232 // elements stored within `self`.
238 /// Returns a mutable slice to the elements forgotten by the vector. It is the caller's
239 /// responsibility to drop these elements if necessary.
246 // INVARIANT: We relinquish ownership of the elements within the range `[self.len - count,
247 // self.len)`, hence the updated value of `set.len` represents the exact number of elements
251 // elements of type `T`.
291 /// Returns `true` if the vector contains no elements, `false` otherwise.
315 // - `len` is zero, since no elements can be or have been stored,
506 // SAFETY: `p.add(1).add(self.len - i - 1)` is `i+1+len-i-1 == len` elements after the
572 /// - The first `length` elements must be initialized values of type `T`.
599 /// This will not run the destructor of the contained elements and for non-ZSTs the allocation
601 /// elements and free the allocation, if any.
630 /// Ensures that the capacity exceeds the length by at least `additional` elements.
710 // SAFETY: the contract of `dec_len` guarantees that the elements in `ptr` are
711 // valid elements whose ownership has been transferred to the caller.
733 // INVARIANT: The first `len` elements of the spare capacity are valid values, and as we
736 elements: elems.iter_mut(),
740 /// Removes all elements that don't match the provided closure.
853 // - `self.as_ptr()` is valid for reads of `self.len()` elements of `T`.
854 // - `new_ptr` is valid for writes of at least `target_cap >= self.len()` elements.
911 // - the loop and the line above initialized the next `n` elements.
917 /// Pushes clones of the elements of slice into the [`Vec`] instance.
1016 // - all elements within `b` are initialized values of `T`,
1044 // initialized elements of type `T`.
1056 // initialized elements of type `T`.
1228 /// An [`Iterator`] implementation for [`Vec`] that moves elements out of a vector.
1296 /// buffer. However, this backing buffer may be shrunk to the actual count of elements.
1340 // SAFETY: If the iterator has been advanced, the advanced elements have been copied to
1483 elements: slice::IterMut<'vec, T>,
1490 let elem: *mut T = self.elements.next()?;
1496 self.elements.size_hint()
1503 let iter = core::mem::take(&mut self.elements);
1567 // Add a few elements.
1605 // Create a vector with large capacity but no elements.
1643 // Add some elements.
1655 // All elements preserved.