Implement IntoIterator for IndexVec
This fixes a clippy warning and slightly improves ergonomic. This is technically a breaking change, but it is unlikely to break code in practice, since `IntoIterator` is in Rust's prelude.
This commit is contained in:
+6
-1
@@ -85,10 +85,15 @@ impl IndexVec {
|
||||
IndexVec::USize(ref v) => IndexVecIter::USize(v.iter()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for IndexVec {
|
||||
type Item = usize;
|
||||
type IntoIter = IndexVecIntoIter;
|
||||
|
||||
/// Convert into an iterator over the indices as a sequence of `usize` values
|
||||
#[inline]
|
||||
pub fn into_iter(self) -> IndexVecIntoIter {
|
||||
fn into_iter(self) -> IndexVecIntoIter {
|
||||
match self {
|
||||
IndexVec::U32(v) => IndexVecIntoIter::U32(v.into_iter()),
|
||||
IndexVec::USize(v) => IndexVecIntoIter::USize(v.into_iter()),
|
||||
|
||||
Reference in New Issue
Block a user