Lines Matching defs:for
150 /// A contiguous growable array type, written as `Vec<T>`, short for 'vector'.
170 /// for x in &vec {
176 /// The [`vec!`] macro is provided for convenient initialization:
259 /// when you just want to provide read access. The same goes for [`String`] and
264 /// The capacity of a vector is the amount of space allocated for any future
272 /// with space for 10 more elements. Pushing 10 or fewer elements onto the
296 /// types inside a `Vec`, it will not allocate space for them. *Note that in this case
300 /// and use it for something else (either to pass to unsafe code, or to build your
332 /// stored on the stack for two reasons:
334 /// * It would make it more difficult for unsafe code to correctly manipulate
363 /// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
370 /// removed data to be erased for security purposes. Even if you drop a `Vec`, its
430 /// reallocating. This method is allowed to allocate for more elements than
456 /// // The vector contains no items, even though it has capacity for more
461 /// for i in 0..10 {
488 /// reallocating. This method is allowed to allocate for more elements than
510 /// // The vector contains no items, even though it has capacity for more
515 /// for i in 0..10 {
573 /// alignments. The buffer was allocated with alignment 2 (for `u16`), but after
608 /// for i in 0..len {
673 /// reallocating. This method is allowed to allocate for more elements than
703 /// // The vector contains no items, even though it has capacity for more
708 /// for i in 0..10 {
735 /// reallocating. This method is allowed to allocate for more elements than
761 /// // The vector contains no items, even though it has capacity for more
766 /// for i in 0..10 {
822 /// alignments. The buffer was allocated with alignment 2 (for `u16`), but after
864 /// for i in 0..len {
912 /// After calling this function, the caller is responsible for the
949 /// After calling this function, the caller is responsible for the
1007 /// Reserves capacity for at least `additional` more elements to be inserted
1030 /// Reserves the minimum capacity for at least `additional` more elements to
1060 /// Tries to reserve capacity for at least `additional` more elements to be inserted
1097 /// Tries to reserve the minimum capacity for at least `additional`
1143 /// may still inform the vector that there is space for a few more elements.
1282 // implications in some cases. See #78884 for more.
1328 /// valid for zero sized reads if the vector didn't allocate.
1346 /// for i in 0..x.len() {
1362 /// raw pointer valid for zero sized reads if the vector didn't allocate.
1372 /// // Allocate vector big enough for 4 elements.
1379 /// for i in 0..size {
1422 /// This method can be useful for situations in which the vector
1423 /// is serving as a buffer for other code, particularly over FFI:
1427 /// # // This is just a minimal skeleton for the doc example;
1428 /// # // don't use this as a starting point for a real library.
1563 // space for the new element
1647 /// In other words, remove all elements `e` for which `f(&e)` returns `false`.
1723 impl<T, A: Allocator> Drop for BackshiftOnDrop<'_, T, A> {
1769 // We use copy for move, and never touch this element again.
1854 impl<'a, T, A: core::alloc::Allocator> Drop for FillGapOnDrop<'a, T, A> {
1945 // or if the length increment would overflow for zero-sized types.
1999 /// for value in iter {
2114 /// [`mem::forget`], for example), the vector may have lost and leaked
2328 /// This function is mainly useful for data that lives for the remainder of
2364 /// // Allocate vector big enough for 10 elements.
2403 /// Note that this is a low-level API, which should be used with care for
2425 /// // Reserve additional space big enough for 10 elements.
2462 // - `ptr` is guaranteed to be valid for `self.len` elements
2470 // - `ptr` is guaranteed to be valid for `self.len` elements
2636 // - `slice::range` guarantees that the given range is valid for indexing self
2702 for _ in 1..n {
2731 for _ in 1..n {
2798 impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
2817 impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
2832 // - `count` is equal to the len of `source`, so source is valid for
2835 // is valid for `count` writes
2846 // Common trait implementations for Vec
2850 impl<T, A: Allocator> ops::Deref for Vec<T, A> {
2860 impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
2869 impl<T: Clone, A: Allocator + Clone> Clone for Vec<T, A> {
2877 // required for this method definition, is not available. Instead use the
2879 // NB see the slice::hack module in slice.rs for more information
2903 impl<T: Hash, A: Allocator> Hash for Vec<T, A> {
2915 impl<T, I: SliceIndex<[T]>, A: Allocator> Index<I> for Vec<T, A> {
2929 impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
2938 impl<T> FromIterator<T> for Vec<T> {
2946 impl<T, A: Allocator> IntoIterator for Vec<T, A> {
2991 impl<'a, T, A: Allocator> IntoIterator for &'a Vec<T, A> {
3001 impl<'a, T, A: Allocator> IntoIterator for &'a mut Vec<T, A> {
3012 impl<T, A: Allocator> Extend<T> for Vec<T, A> {
3034 // This is the case for a general iterator.
3038 // for item in iterator {
3060 // This is the case for a general iterator.
3064 // for item in iterator {
3085 // specific extend for `TrustedLen` iterators, called both by the specializations
3113 // This avoids additional codegen for a fallback code path which would eventually
3119 // specific extend for `TrustedLen` iterators, called both by the specializations
3260 /// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
3266 impl<'a, T: Copy + 'a, A: Allocator> Extend<&'a T> for Vec<T, A> {
3284 impl<T, A1, A2> PartialOrd<Vec<T, A2>> for Vec<T, A1>
3297 impl<T: Eq, A: Allocator> Eq for Vec<T, A> {}
3301 impl<T: Ord, A: Allocator> Ord for Vec<T, A> {
3309 unsafe impl<#[may_dangle] T, A: Allocator> Drop for Vec<T, A> {
3312 // use drop for [T]
3322 impl<T> Default for Vec<T> {
3332 impl<T: fmt::Debug, A: Allocator> fmt::Debug for Vec<T, A> {
3339 impl<T, A: Allocator> AsRef<Vec<T, A>> for Vec<T, A> {
3346 impl<T, A: Allocator> AsMut<Vec<T, A>> for Vec<T, A> {
3353 impl<T, A: Allocator> AsRef<[T]> for Vec<T, A> {
3360 impl<T, A: Allocator> AsMut<[T]> for Vec<T, A> {
3368 impl<T: Clone> From<&[T]> for Vec<T> {
3388 impl<T: Clone> From<&mut [T]> for Vec<T> {
3408 impl<T, const N: usize> From<[T; N]> for Vec<T> {
3429 impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
3455 impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
3474 impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
3500 impl From<&str> for Vec<u8> {
3514 impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {