mirror of
https://github.com/openharmony/third_party_rust_tinyvec.git
synced 2026-07-19 22:33:42 -04:00
impl IntoIterator for &/&mut ArrayVec (#69)
These just create slice iterators, but the impls are useful to have for contexts that don't auto-deref, as in the new tests.
This commit is contained in:
@@ -959,6 +959,26 @@ impl<A: Array> IntoIterator for ArrayVec<A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A: Array> IntoIterator for &'a mut ArrayVec<A> {
|
||||
type Item = &'a mut A::Item;
|
||||
type IntoIter = core::slice::IterMut<'a, A::Item>;
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A: Array> IntoIterator for &'a ArrayVec<A> {
|
||||
type Item = &'a A::Item;
|
||||
type IntoIter = core::slice::Iter<'a, A::Item>;
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Array> PartialEq for ArrayVec<A>
|
||||
where
|
||||
A::Item: PartialEq,
|
||||
|
||||
+2
-2
@@ -840,7 +840,7 @@ impl<A: Array> IntoIterator for TinyVec<A> {
|
||||
|
||||
impl<'a, A: Array> IntoIterator for &'a mut TinyVec<A> {
|
||||
type Item = &'a mut A::Item;
|
||||
type IntoIter = alloc::slice::IterMut<'a, A::Item>;
|
||||
type IntoIter = core::slice::IterMut<'a, A::Item>;
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
@@ -850,7 +850,7 @@ impl<'a, A: Array> IntoIterator for &'a mut TinyVec<A> {
|
||||
|
||||
impl<'a, A: Array> IntoIterator for &'a TinyVec<A> {
|
||||
type Item = &'a A::Item;
|
||||
type IntoIter = alloc::slice::Iter<'a, A::Item>;
|
||||
type IntoIter = core::slice::Iter<'a, A::Item>;
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
|
||||
Reference in New Issue
Block a user