Lines Matching refs:from
7 //! *O*(1) pop (from the end).
181 /// let vec2 = Vec::from([1, 2, 3, 4]);
364 /// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
366 /// `Vec` will not specifically overwrite any data that is removed from it,
540 /// Creates a `Vec<T>` directly from a pointer, a capacity, and a length.
568 /// to build a `Vec<u8>` from a pointer to a C `char` array with length
571 /// It's also not safe to build one from a `Vec<u16>` and its length, because
791 /// Creates a `Vec<T, A>` directly from a pointer, a capacity, a length,
819 /// to build a `Vec<u8>` from a pointer to a C `char` array with length `size_t`.
820 /// It's also not safe to build one from a `Vec<u16>` and its length, because
1337 /// derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`].
1487 /// Removes an element from the vector and returns it.
1596 /// elements from the beginning of the `Vec`, consider using
1631 // the place we are taking from.
1816 /// The `same_bucket` function is passed references to two elements from the vector and
1818 /// from their order in the slice, so if `same_bucket(a, b)` returns `true`, `a` is removed.
2024 /// Removes the last element from a vector and returns it, or [`None`] if it
2077 /// Appends elements to `self` from other buffer.
2088 /// Tries to append elements to `self` from other buffer.
2099 /// Removes the specified range from the vector in bulk, returning all
2137 // the source vector to make sure no uninitialized or moved-from elements
2155 vec: NonNull::from(self),
2180 // - `elems` comes directly from `as_mut_slice` and is therefore valid.
2283 /// calling the closure `f`. The return values from `f` will end up
2356 /// reading from a file) before marking the data as initialized using the
2398 /// (e.g. by reading from a file) before marking the data as initialized using
2605 /// Copies elements from `src` range to the end of the vector.
2828 // - Both pointers are created from unique slice references (`&mut [_]`)
2951 /// the vector (from start to end). The vector cannot be used after calling
3154 /// It is unspecified how many elements are removed from the vector
3374 /// assert_eq!(Vec::from(&[1, 2, 3][..]), vec![1, 2, 3]);
3377 fn from(s: &[T]) -> Vec<T> {
3381 fn from(s: &[T]) -> Vec<T> {
3394 /// assert_eq!(Vec::from(&mut [1, 2, 3][..]), vec![1, 2, 3]);
3397 fn from(s: &mut [T]) -> Vec<T> {
3401 fn from(s: &mut [T]) -> Vec<T> {
3414 /// assert_eq!(Vec::from([1, 2, 3]), vec![1, 2, 3]);
3417 fn from(s: [T; N]) -> Vec<T> {
3422 fn from(s: [T; N]) -> Vec<T> {
3445 /// assert_eq!(Vec::from(o), Vec::from(b));
3447 fn from(s: Cow<'a, [T]>) -> Vec<T> {
3463 /// assert_eq!(Vec::from(b), vec![1, 2, 3]);
3465 fn from(s: Box<[T], A>) -> Self {
3483 /// assert_eq!(Box::from(vec![1, 2, 3]), vec![1, 2, 3].into_boxed_slice());
3491 /// assert_eq!(Box::from(vec), vec![1, 2, 3].into_boxed_slice());
3493 fn from(v: Vec<T, A>) -> Self {
3506 /// assert_eq!(Vec::from("123"), vec![b'1', b'2', b'3']);
3508 fn from(s: &str) -> Vec<u8> {
3509 From::from(s.as_bytes())
3536 /// let mut v = String::from("hello world").into_bytes();