into
Prefix for methods that convert self into another type. Consumes self,
returns an owned value.
// Copyright 2025 Google LLC // SPDX-License-Identifier: Apache-2.0 pub trait IntoIterator { fn into_iter(self) -> Self::IntoIter; } impl str { fn into_string(self: Box<str>) -> String; }
-
Prefix for a function that consumes an owned value and transforms it into a value of another type.
-
Not reinterpret cast! The data can be rearranged, reallocated, changed in any way, including losing information.
-
into_iterconsumes a collection (like a vec, or a btreeset, or a hashmap) and produces an iterator over owned values, unlikeiteranditer_mutwhich produce iterators over reference values.