Lines Matching defs:vector

8199     // invalidate references into the vector (such as `v0`).  This test also
8838 // 4 times (3 for items already in vector, 1 for just appended).
9432 // Test fixed length vector.
9721 // create a vector like [(6, 1), (5, 1), (6, 2), ...],
13902 /// example, `vec![Rc::new(1); 5]` will create a vector of five references
13906 /// Also, note that `vec![expr; 0]` is allowed, and produces an empty vector.
14730 /// # let mut vector = MyVec { buf: RawVec::new(), len: 0 };
14731 /// # vector.push_all(&[1, 3, 5, 7, 9]);
16198 //! If you have a vector of valid UTF-8 bytes, you can make a [`String`] out of
16261 /// If you have a vector of UTF-8 bytes, you can create a `String` from it with
16265 /// // some bytes, in a vector
16454 /// A possible error value when converting a `String` from a UTF-8 byte vector.
16458 /// [`into_bytes`] method will give back the byte vector that was used in the
16479 /// // some invalid bytes, in a vector
16595 /// Converts a vector of bytes to a `String`.
16597 /// A string ([`String`]) is made of bytes ([`u8`]), and a vector of bytes
16608 /// This method will take care to not copy the vector, for efficiency's
16619 /// provided bytes are not UTF-8. The vector you moved in is also included.
16626 /// // some bytes, in a vector
16638 /// // some invalid bytes, in a vector
16692 /// // some bytes, in a vector
16742 /// Decode a UTF-16–encoded vector `v` into a `String`, returning [`Err`]
16888 /// Converts a vector of bytes to a `String` without checking that the
16907 /// // some bytes, in a vector
16922 /// Converts a `String` into a byte vector.
17745 // of the vector version. The data is just plain bytes.
17789 // Replace_range does not have the memory safety issues of a vector Splice.
17790 // of the vector version. The data is just plain bytes.
17844 /// // some invalid bytes, in a vector
17867 /// // some invalid bytes, in a vector
17894 /// // some invalid bytes, in a vector
18667 /// Converts the given `String` to a vector `Vec` that holds values of type `u8`.
18936 /// // Clones into a vector if not already owned.
19673 //! // vector of `Gadget`s inside a `RefCell` so that we can mutate it through
22367 // Helper macro for indexing our vector by the smallest possible type, to reduce allocation.
22450 /// Converts `self` into a vector without clones or allocation.
22452 /// The resulting vector can be converted back into a box via
22471 /// Creates a vector by repeating a slice `n` times.
22607 /// Returns a vector containing a copy of this slice where each byte
22624 /// Returns a vector containing a copy of this slice where each byte
26183 //! // of this format is to print the magnitude of a vector.
40361 //! container. It also has *O*(1) indexing like a vector. The contained elements
40815 /// let vector: VecDeque<u32> = VecDeque::new();
40829 /// let vector: VecDeque<u32> = VecDeque::with_capacity(10);
41326 /// let mut vector = VecDeque::new();
41328 /// vector.push_back(0);
41329 /// vector.push_back(1);
41330 /// vector.push_back(2);
41332 /// assert_eq!(vector.as_slices(), (&[0, 1, 2][..], &[][..]));
41334 /// vector.push_front(10);
41335 /// vector.push_front(9);
41337 /// assert_eq!(vector.as_slices(), (&[9, 10][..], &[0, 1, 2][..]));
41361 /// let mut vector = VecDeque::new();
41363 /// vector.push_back(0);
41364 /// vector.push_back(1);
41366 /// vector.push_front(10);
41367 /// vector.push_front(9);
41369 /// vector.as_mut_slices().0[0] = 42;
41370 /// vector.as_mut_slices().1[0] = 24;
41371 /// assert_eq!(vector.as_slices(), (&[42, 10][..], &[24, 1][..]));
41434 /// the end point is greater than the length of the vector.
41469 /// the end point is greater than the length of the vector.
41519 /// the end point is greater than the length of the vector.
41616 /// let mut vector: VecDeque<u32> = VecDeque::new();
41618 /// vector.push_back(0);
41619 /// vector.push_back(1);
41621 /// assert_eq!(vector.contains(&1), true);
41622 /// assert_eq!(vector.contains(&10), false);
44271 //! Checking the largest element is *O*(1). Converting a vector to a binary heap
44273 //! converted to a sorted vector in-place, allowing it to be used for an *O*(*n* \* log(*n*))
44751 /// Consumes the `BinaryHeap` and returns a vector in sorted
44790 // order to move an element out of the vector (leaving behind a
44792 // vector at the final location of the hole.
45071 /// Returns an iterator visiting all values in the underlying vector, in
45249 /// Returns a slice of all values in the underlying vector, in arbitrary
45270 /// Consumes the `BinaryHeap` and returns the underlying vector
45857 /// An iterator that moves out of a vector.
46454 // Unroll the first iteration, as the vector is going to be
46457 // vector being full in the few subsequent loop iterations.
46459 let mut vector = match iterator.next() {
46463 let mut vector = Vec::with_capacity(lower.saturating_add(1));
46465 ptr::write(vector.as_mut_ptr(), element);
46466 vector.set_len(1);
46468 vector
46473 <Vec<T> as SpecExtend<T, I>>::spec_extend(&mut vector, iterator);
46474 vector
46483 let mut vector = match iterator.size_hint() {
46492 vector.spec_extend(iterator);
46493 vector
46608 // A common case is passing a vector into a function which immediately
46609 // re-collects into a vector. We can short circuit this if the IntoIter
46835 //! You can [`push`] values onto the end of a vector (which will grow the vector
46937 /// A contiguous growable array type, written as `Vec<T>` and pronounced 'vector'.
46973 /// in separate steps, especially when initializing a vector of zeros:
47050 /// The capacity of a vector is the amount of space allocated for any future
47051 /// elements that will be added onto the vector. This is not to be confused with
47052 /// the *length* of a vector, which specifies the number of actual elements
47053 /// within the vector. If a vector's length exceeds its capacity, its capacity
47057 /// For example, a vector with capacity 10 and length 0 would be an empty vector
47059 /// vector will not change its capacity or cause reallocation to occur. However,
47060 /// if the vector's length is increased to 11, it will have to reallocate, which
47062 /// whenever possible to specify how big the vector is expected to get.
47096 /// A vector containing the elements `'a'` and `'b'` with capacity 4 can be
47194 /// The vector will not allocate until elements are pushed onto it.
47211 /// The vector will be able to hold exactly `capacity` elements without
47212 /// reallocating. If `capacity` is 0, the vector will not allocate.
47214 /// It is important to note that although the returned vector has the
47215 /// *capacity* specified, the vector will have a zero *length*. For an
47230 /// // The vector contains no items, even though it has capacity for more
47241 /// // ...but this may make the vector reallocate
47253 /// Creates a `Vec<T>` directly from the raw components of another vector.
47325 /// The vector will not allocate until elements are pushed onto it.
47346 /// The vector will be able to hold exactly `capacity` elements without
47347 /// reallocating. If `capacity` is 0, the vector will not allocate.
47349 /// It is important to note that although the returned vector has the
47350 /// *capacity* specified, the vector will have a zero *length*. For an
47369 /// // The vector contains no items, even though it has capacity for more
47380 /// // ...but this may make the vector reallocate
47391 /// Creates a `Vec<T, A>` directly from the raw components of another vector.
47470 /// the vector (in elements), and the allocated capacity of the
47507 /// Returns the raw pointer to the underlying data, the length of the vector (in elements),
47553 /// Returns the number of elements the vector can hold without
47697 /// Shrinks the capacity of the vector as much as possible.
47700 /// may still inform the vector that there is space for a few more elements.
47722 /// Shrinks the capacity of the vector with a lower bound.
47749 /// Converts the vector into [`Box<[T]>`][owned slice].
47784 /// Shortens the vector, keeping the first `len` elements and dropping
47787 /// If `len` is greater than the vector's current length, this has no
47794 /// of the vector.
47798 /// Truncating a five element vector to two elements:
47806 /// No truncation occurs when `len` is greater than the vector's current
47832 // * the `len` of the vector is shrunk before calling `drop_in_place`,
47849 /// Extracts a slice containing the entire vector.
47866 /// Extracts a mutable slice of the entire vector.
47883 /// Returns a raw pointer to the vector's buffer.
47885 /// The caller must ensure that the vector outlives the pointer this
47887 /// Modifying the vector may cause its buffer to be reallocated,
47920 /// Returns an unsafe mutable pointer to the vector's buffer.
47922 /// The caller must ensure that the vector outlives the pointer this
47924 /// Modifying the vector may cause its buffer to be reallocated,
47930 /// // Allocate vector big enough for 4 elements.
47963 /// Forces the length of the vector to `new_len`.
47966 /// invariants of the type. Normally changing the length of a vector
47984 /// This method can be useful for situations in which the vector
48049 /// Removes an element from the vector and returns it.
48051 /// The removed element is replaced by the last element of the vector.
48094 /// Inserts an element at position `index` within the vector, shifting all
48144 /// Removes and returns the element at position `index` within the vector,
48177 // the stack and in the vector at the same time.
48288 /// Removes all but the first of consecutive elements in the vector that resolve to the same
48291 /// If the vector is sorted, this removes all duplicates.
48312 /// Removes all but the first of consecutive elements in the vector satisfying a given equality
48315 /// The `same_bucket` function is passed references to two elements from the vector and
48319 /// If the vector is sorted, this removes all duplicates.
48453 /// Removes the last element from a vector and returns it, or [`None`] if it
48480 /// Panics if the number of elements in the vector overflows a `usize`.
48510 /// Creates a draining iterator that removes the specified range in the vector
48514 /// from the vector, even if the iterator was not fully consumed. If the
48521 /// the end point is greater than the length of the vector.
48531 /// // A full range clears the vector
48543 // the source vector to make sure no uninitialized or moved-from elements
48548 // the hole, and the vector length is restored to the new length.
48568 /// Clears the vector, removing all values.
48571 /// of the vector.
48588 /// Returns the number of elements in the vector, also referred to
48604 /// Returns `true` if the vector contains no elements.
48622 /// Returns a newly allocated vector containing the elements in the range
48623 /// `[at, len)`. After the call, the original vector will be left containing
48656 // the new vector can take over the original buffer and avoid the copy
48746 /// Returns the remaining spare capacity of the vector as a slice of
48749 /// The returned slice can be used to fill the vector with data (e.g. by
48760 /// // Allocate vector big enough for 10 elements.
48769 /// // Mark the first 3 elements of the vector as being initialized.
48790 /// Returns vector content as a slice of `T`, along with the remaining spare
48791 /// capacity of the vector as a slice of `MaybeUninit<T>`.
48793 /// The returned spare capacity slice can be used to fill the vector with data
48833 /// // Mark the 4 elements of the vector as being initialized.
48909 /// it to this `Vec`. The `other` vector is traversed in-order.
48930 /// Copies elements from `src` range to the end of the vector.
48999 /// Extend the vector by `n` values, using the given generator.
49030 /// Removes consecutive repeated elements in the vector according to the
49033 /// If the vector is sorted, this removes all duplicates.
49184 message = "vector indices are of type `usize` or ranges of `usize`",
49185 label = "vector indices are of type `usize` or ranges of `usize`"
49198 message = "vector indices are of type `usize` or ranges of `usize`",
49199 label = "vector indices are of type `usize` or ranges of `usize`"
49222 /// the vector (from start to end). The vector cannot be used after calling
49321 /// Creates a splicing iterator that replaces the specified range in the vector
49327 /// It is unspecified how many elements are removed from the vector
49334 /// * The tail (elements in the vector after `range`) is empty,
49338 /// Otherwise, a temporary vector is allocated and the tail is moved twice.
49343 /// the end point is greater than the length of the vector.
49367 /// If the closure returns false, the element will remain in the vector and will not be yielded
49473 // use a raw slice to refer to the elements of the vector as weakest necessary type;
49586 /// Convert a clone-on-write slice into a vector.
49609 /// Convert a boxed slice into a vector by transferring ownership of
49627 /// Convert a vector into a boxed slice.
50034 // This is a zero-length vector which does not allocate if `lower_bound` was exact.