Lines Matching refs:into
3403 // Collecting into a `Vec<T>` or `Rc<[T]>` should make no difference:
3425 // Collecting into a `Vec<T>` or `Rc<[T]>` should make no difference:
3909 let mut v: String = $data.into();
3927 let v: String = $data.into();
3935 let mut v: String = $data.into();
6459 let s: String = 'x'.into();
8199 // invalidate references into the vector (such as `v0`). This test also
9156 // Collecting into a `Vec<T>` or `Rc<[T]>` should make no difference:
9178 // Collecting into a `Vec<T>` or `Rc<[T]>` should make no difference:
9854 assert_eq!(["a".to_string(), "ab".into()].join(","), "a,ab");
9855 assert_eq!(["a".to_string(), "ab".into(), "abc".into()].join(","), "a,ab,abc");
9856 assert_eq!(["a".to_string(), "ab".into(), "".into()].join(","), "a,ab,");
12870 let deque: VecDeque<_> = vec![1, 2, 3, 5, 6].into();
12876 let mut deque: VecDeque<_> = vec![5, 6].into();
12892 let deque: VecDeque<_> = vec![(1,), (2,), (3,), (5,), (6,)].into();
12900 let deque: VecDeque<_> = vec![(1,), (2,), (3,), (5,), (6,)].into();
12909 let deque: VecDeque<_> = vec![1, 2, 3, 5, 6].into();
12914 let mut deque: VecDeque<_> = vec![5, 6].into();
13674 // Check that 20 moved into 10's place.
14334 alloc.deallocate(ptr.cast().into(), layout)
14401 /// Specialize clones into pre-allocated, uninitialized memory.
14568 /// Converts a `Box<[T]>` into a `RawVec<T>`.
14576 /// Converts the entire buffer into `Box<[MaybeUninit<T>]>` with the specified `len`.
14679 Some((self.ptr.cast().into(), layout))
15135 .expect("attempt to join into collection with len > usize::MAX");
15196 /// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
15211 self.into()
15216 /// `replace` creates a new [`String`], and copies the data from this string slice into it.
15254 /// `replacen` creates a new [`String`], and copies the data from this string slice into it.
15296 /// Since some characters can expand into multiple characters when changing
15381 /// Since some characters can expand into multiple characters when changing
15429 /// Converts a [`Box<str>`] into a [`String`] without copying or allocating.
16186 //! let s: String = "also this".into();
16281 /// you cannot index into a `String`:
16742 /// Decode a UTF-16–encoded vector `v` into a `String`, returning [`Err`]
16776 /// Decode a UTF-16–encoded slice `v` into a `String`, replacing
16806 /// Decomposes a `String` into its raw components.
16816 /// into a `String` with the [`from_raw_parts`] function, allowing
16922 /// Converts a `String` into a byte vector.
16959 /// Converts a `String` into a mutable string slice.
17503 /// Inserts a character into this `String` at a byte position.
17550 /// Inserts a string slice into this `String` at a byte position.
17653 /// Splits the string into two at the given byte index.
17813 /// Converts this `String` into a [`Box`]`<`[`str`]`>`.
18219 /// The string on the right-hand side is only borrowed; its contents are copied into the returned
18520 /// Converts a `&mut str` into a `String`.
18589 /// Converts a string slice into a Borrowed variant.
18607 /// Converts a String into an Owned variant.
18627 /// Converts a String reference into a Borrowed variant.
18936 /// // Clones into a vector if not already owned.
18974 /// let borrowed = Items::new((&readonly[..]).into());
18981 /// // Mutates the data from slice into owned vec and pushes a new value on top
19639 //! `Owner` to `Gadget`, we will run into problems. An [`Rc`] pointer from `Owner`
19772 // would interfere with otherwise safe [into|from]_raw() of transmutable
19843 Box::leak(box RcBox { strong: Cell::new(1), weak: Cell::new(1), value }).into(),
19880 .into();
19993 .into(),
20482 /// Returns a mutable reference into the given `Rc`, if there are
20512 /// Returns a mutable reference into the given `Rc`,
20572 /// Makes a mutable reference into the given `Rc`.
20789 /// Copy elements from slice into newly allocated Rc<\[T\]>
20806 // into the new RcBox will be dropped, then the memory freed.
21235 /// Allocate a reference-counted string slice and copy `v` into it.
21253 /// Allocate a reference-counted string slice and copy `v` into it.
21289 /// Allocate a reference-counted slice and move `v`'s items into it.
21342 /// Takes each element in the `Iterator` and collects it into an `Rc<[T]>`.
21348 /// In the general case, collecting into `Rc<[T]>` is done by first
21349 /// collecting into a `Vec<T>`. That is, when writing the following:
21363 /// .into(); // A second allocation for `Rc<[T]>` happens here.
21368 /// and then it will allocate once for turning the `Vec<T>` into the `Rc<[T]>`.
21385 /// Specialization trait used for collecting into `Rc<[T]>`.
21392 self.collect::<Vec<T>>().into()
21415 // The default implementation would collect into a vec which would panic.
21538 /// Consumes the `Weak<T>` and turns it into a raw pointer.
21540 /// This converts the weak pointer into a raw pointer, while still preserving the ownership of
21542 /// back into the `Weak<T>` with [`from_raw`].
21572 /// Converts a raw pointer previously created by [`into_raw`] back into `Weak<T>`.
21972 //! A dynamically-sized view into a contiguous sequence, `[T]`.
21976 //! Slices are a view into a block of memory represented as a pointer and a
22408 /// Copies `self` into a new `Vec`.
22427 /// Copies `self` into a new `Vec` with an allocator.
22450 /// Converts `self` into a vector without clones or allocation.
22452 /// The resulting vector can be converted back into a box via
22460 /// // `s` cannot be used anymore because it has been converted into `x`.
22550 /// Flattens a slice of `T` into a single value `Self::Output`.
22566 /// Flattens a slice of `T` into a single value `Self::Output`, placing a
22584 /// Flattens a slice of `T` into a single value `Self::Output`, placing a
22806 /// Inserts `v[0]` into pre-sorted sequence `v[1..]` so that whole `v[..]` becomes sorted.
22822 // elements succeeding it to make room for it and finally place it into the
22825 // 3. Copy the first element into a temporary variable. Iterate until the right place
22826 // for it is found. As we go along, copy every traversed element into the slot
22827 // preceding it. Finally, copy data from the temporary variable into the remaining
22854 // `hole` gets dropped and thus copies `tmp` into the remaining hole in `v`.
22858 // When dropped, copies from `src` into `dest`.
22874 /// stores the result into `v[..]`.
22888 // The merge process first copies the shorter run into `buf`. Then it traces the newly copied
22890 // copying the lesser (or greater) one into `v`.
22893 // consumed first, then we must copy whatever is left of the shorter run into the remaining
22957 // it will now be copied into the hole in `v`.
22970 // When dropped, copies the range `start..end` into `dest..`.
23058 // Insert some more elements into the run if it's too short. Insertion sort is faster than
23176 /// let waker = Arc::new(ThreadWaker(t)).into();
23234 // inlining this into the `From<Arc<W>> for RawWaker` impl, to ensure that
23249 // Wake by value, moving the Arc into the Wake::wake function
23570 // would interfere with otherwise safe [into|from]_raw() of transmutable
23607 Self::from_inner(Box::leak(x).into())
23640 .into();
23654 // reference into a strong reference.
23774 Ok(Self::from_inner(Box::leak(x).into()))
24151 // into usize::MAX; in general both Rc and Arc need to be adjusted
24439 /// Copy elements from slice into newly allocated Arc<\[T\]>
24458 // into the new ArcInner will be dropped, then the memory freed.
24582 /// Makes a mutable reference into the given `Arc`.
24671 /// Returns a mutable reference into the given `Arc`, if there are
24710 /// Returns a mutable reference into the given `Arc`,
24950 /// Consumes the `Weak<T>` and turns it into a raw pointer.
24952 /// This converts the weak pointer into a raw pointer, while still preserving the ownership of
24954 /// back into the `Weak<T>` with [`from_raw`].
24984 /// Converts a raw pointer previously created by [`into_raw`] back into `Weak<T>`.
25576 /// Allocate a reference-counted `str` and copy `v` into it.
25594 /// Allocate a reference-counted `str` and copy `v` into it.
25630 /// Allocate a reference-counted slice and move `v`'s items into it.
25683 /// Takes each element in the `Iterator` and collects it into an `Arc<[T]>`.
25689 /// In the general case, collecting into `Arc<[T]>` is done by first
25690 /// collecting into a `Vec<T>`. That is, when writing the following:
25704 /// .into(); // A second allocation for `Arc<[T]>` happens here.
25709 /// and then it will allocate once for turning the `Vec<T>` into the `Arc<[T]>`.
25726 /// Specialization trait used for collecting into `Arc<[T]>`.
25733 self.collect::<Vec<T>>().into()
25756 // The default implementation would collect into a vec which would panic.
25805 //! order to format arguments at runtime into strings.
26144 //! should emit output into the `f.buf` stream. It is up to each format trait
27080 // to maintain validity of aliasing pointers into `element`.
27084 let node = Some(Box::leak(node).into());
27101 // to maintain validity of aliasing pointers into `element`.
27121 // to maintain validity of aliasing pointers into `element`.
27125 let node = Some(Box::leak(node).into());
27142 // to maintain validity of aliasing pointers into `element`.
27197 // to maintain validity of aliasing pointers into `element`.
27342 /// This reuses all the nodes from `other` and moves them into `self`. After
27777 /// Splits the list into two at the given index. Returns everything after the given index,
27891 /// Splitting a list into evens and odds, reusing the original list:
28310 /// Inserts a new element into the `LinkedList` after the current one.
28317 let spliced_node = Box::leak(Box::new(Node::new(item))).into();
28330 /// Inserts a new element into the `LinkedList` before the current one.
28337 let spliced_node = Box::leak(Box::new(Node::new(item))).into();
28433 /// Splits the list into two after the current element. This will return a
28449 /// Splits the list into two before the current element. This will return a
28585 /// Consumes the list into an iterator yielding elements by value.
28939 // This caused the RHS's dtor to walk up into the LHS at drop and delete all of
29208 // We prepare to merge `left` and `right` into a sorted sequence in linear time.
29223 // Iterate through all key-value pairs, pushing them into nodes at the right level.
29225 // Try to push key-value pair into the current leaf node.
29273 // An iterator for merging two sorted sequences into one
30277 /// // entries can now be inserted into the empty map
30592 /// Inserts a key-value pair into the map.
30632 /// Tries to insert a key-value pair into the map, and returns
30752 /// Moves all elements from `other` into `Self`, leaving `other` empty.
30923 /// Splits the collection into two at the given key. Returns everything after the given key,
30992 /// Splitting a map into even and odd keys, reusing the original map:
33037 /// Moves all elements from `other` into `Self`, leaving `other` empty.
33073 /// Splits the collection into two at the given key. Returns everything after the given key,
33125 /// Splitting a set into even and odd values, reusing the original set:
33874 /// Splits a unique reference into a pair of leaf edges delimiting a specified range.
33892 /// Splits a unique reference into a pair of leaf edges delimiting the full range of the tree.
33904 /// Splits a unique reference into a pair of leaf edges delimiting the full range of the tree.
33987 /// Given a leaf edge handle into a dying tree, returns the next leaf edge
34015 /// Given a leaf edge handle into a dying tree, returns the next leaf edge
35056 /// A view into a single entry in a map, which may either be vacant or occupied.
35082 /// A view into a vacant entry in a `BTreeMap`.
35101 /// A view into an occupied entry in a `BTreeMap`.
35248 /// potential inserts into the map.
35474 /// Converts the entry into a mutable reference to its value.
36053 // Descend into first child.
36055 // Descend into first child again, after running through second child.
37975 /// This node's index into the parent node's `edges` array.
38294 // SAFETY: there can be no mutable references into this tree borrowed as `Immut`.
38298 /// Borrows a view into the keys stored in the node.
38735 /// Given an edge index where we want to insert into a node filled to capacity,
38866 /// insert the split off portion into the parent node recursively, until the root is reached.
38999 /// Splits the underlying node into three parts:
39004 /// - All the key-value pairs to the right of this handle are put into a newly
39016 /// that the key-value pair collapsed into.
39031 /// Splits the underlying node into three parts:
39036 /// - All the edges and key-value pairs to the right of this handle are put into
39201 /// Merges the parent's key-value pair and both adjacent child nodes into
39209 /// Merges the parent's key-value pair and both adjacent child nodes into
39217 /// Merges the parent's key-value pair and both adjacent child nodes into
39241 /// of the parent, while pushing the old parent key-value pair into the right child.
39564 /// Inserts a value into a slice of initialized elements followed by one uninitialized element.
40300 /// For example, given deques "A" and "B" with the following division into slices:
40346 // Move a1 into a0, if it's empty (and b1, b0 the same way).
40441 // tail and head are pointers into the buffer. Tail always points
40525 /// Turn ptr into a slice
40531 /// Turn ptr into a mut slice
40543 /// Writes an element into the buffer, moving it.
41553 // The deque's elements are parted into three segments:
42045 // copy last element into empty spot at bottom of buffer
42069 // copy last element into empty spot at bottom of buffer
42089 // copy last element into empty spot at bottom of buffer
42262 // copy first element into empty spot
42286 // copy last element into empty spot
42300 /// Splits the `VecDeque` into two at the given index.
42370 /// Moves all the elements of `other` into `self`, leaving `other` empty.
42646 /// - Rotates item `mid` into the first position.
42689 /// - Rotates the first item into position `k`.
42779 /// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
42795 /// let mut deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
42839 /// let deque: VecDeque<_> = vec![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55].into();
42895 /// (1, 21), (2, 34), (4, 55)].into();
42937 /// let deque: VecDeque<_> = vec![1, 2, 3, 3, 5, 6, 7].into();
43114 /// Consumes the `VecDeque` into a front-to-back iterator yielding elements by
43201 /// Turn a [`Vec<T>`] into a [`VecDeque<T>`].
43236 /// Turn a [`VecDeque<T>`] into a [`Vec<T>`].
44791 // hole), shift along the others and move the removed element back into the
44970 /// Moves all the elements of `other` into `self`, leaving `other` empty.
45289 self.into()
45724 /// Converts a `Vec<T>` into a `BinaryHeap<T>`.
45736 /// Converts a `BinaryHeap<T>` into a `Vec<T>`.
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
46670 /// Specialization marker for collecting an iterator pipeline into a Vec while reusing the
46736 // if the drop panics then we also leak any elements collected into dst_buf
46763 /// Collects an iterator (`self`) into the destination buffer (`dst`) and returns the number of items
47275 /// turning it into a `Vec<u8>` it'll be deallocated with alignment 1.
47310 /// // Put everything back together into a Vec
47413 /// turning it into a `Vec<u8>` it'll be deallocated with alignment 1.
47456 /// // Put everything back together into a Vec
47467 /// Decomposes a `Vec<T>` into its raw components.
47477 /// into a `Vec` with the [`from_raw_parts`] function, allowing
47505 /// Decomposes a `Vec<T>` into its raw components.
47514 /// into a `Vec` with the [`from_raw_parts_in`] function, allowing
47749 /// Converts the vector into [`Box<[T]>`][owned slice].
48134 // `index`th element into two consecutive places.)
48476 /// Moves all the elements of `other` into `Self`, leaving `other` empty.
48620 /// Splits the collection into two at the given index.
49396 /// Splitting an array into evens and odds, reusing the original allocation:
49568 /// Allocate a `Vec<T>` and move `s`'s items into it.
49586 /// Convert a clone-on-write slice into a vector.
49590 /// filled by cloning `s`'s items into it.
49609 /// Convert a boxed slice into a vector by transferring ownership of
49627 /// Convert a vector into a boxed slice.
49629 /// If `v` has excess capacity, its items will be moved into a
50230 //! with `Layout::for_value(&*value)` may be converted into a box using
50238 //! pointer pointing into previously allocated memory that since got freed is
50281 //! this does not mean that you can convert an arbitrary `T*` into a `Box<T>`
50341 /// Allocates memory on the heap and then places `x` into it.
50412 (box x).into()
50415 /// Allocates memory on the heap then places `x` into it,
50489 /// Allocates memory in the given allocator then places `x` into it.
50512 /// Allocates memory in the given allocator then places `x` into it,
50669 Self::new_in(x, alloc).into()
50672 /// Converts a `Box<T>` into a `Box<[T]>`
50991 /// into account the [memory layout] used by `Box`. The easiest way to
50992 /// do this is to convert the raw pointer back into a `Box` with the
51001 /// Converting the raw pointer back into a `Box` with [`Box::from_raw`]
51036 /// into account the [memory layout] used by `Box`. The easiest way to
51037 /// do this is to convert the raw pointer back into a `Box` with the
51046 /// Converting the raw pointer back into a `Box` with [`Box::from_raw_in`]
51085 reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
51091 // raw pointer for the type system. Turning it directly into a raw pointer would not be
51154 /// Converts a `Box<T>` into a `Pin<Box<T>>`
51226 /// Copies `source`'s contents into `self` without creating a new allocation.
51253 let buf: Box<[u8]> = self.as_bytes().into();
51357 /// Converts a generic type `T` into a `Box<T>`
51360 /// from the stack into it.
51379 /// Converts a `Box<T>` into a `Pin<Box<T>>`
51389 /// Converts a `&[T]` into a `Box<[T]>`
51425 /// Converts a `&str` into a `Box<str>`
51454 /// Converts a `Box<str>` into a `Box<[u8]>`
51479 /// Converts a `[T; N]` into a `Box<[T]>`