impl AsRef<[T]> for vec::IntoIter by CAD97 · Pull Request #72583 · rust-lang/rust (original) (raw)
Adds impl<T> AsRef<[T]> for vec::IntoIter<T>
. This mirrors the same trait impl for slice::Iter. Both types already offer fn as_slice(&self) -> &[T]
, this just adds the trait impl for vec::IntoIter
.
If/when fn as_slice(&self) -> &[T]
stabilizes for vec::Drain
and slice::IterMut
, they should get AsRef<[T]>
impls as well. As thus, tangentially related to #58957.
My ultimate goal here: being able to use for<T, I: Iterator<Item=T> + AsRef<[T]>> I
to refer to vec::IntoIter
, vec::Drain
, and eventually array::IntoIter
, as an approximation of the set of by-value iterators that can be "previewed" as by-ref iterators. (Actually expressing that as a trait requires GAT.)