Make VecPerParamSpace support IntoIterator

This commit is contained in:
Niko Matsakis 2015-02-11 05:59:59 -05:00
parent acd1a0090a
commit bea8b81225

View File

@ -18,6 +18,7 @@
use util::ppaux::Repr;
use std::fmt;
use std::iter::IntoIterator;
use std::slice::Iter;
use std::vec::{Vec, IntoIter};
use syntax::codemap::{Span, DUMMY_SP};
@ -529,6 +530,23 @@ fn next(&mut self) -> Option<(ParamSpace, uint, &'a T)> {
}
}
impl<T> IntoIterator for VecPerParamSpace<T> {
type IntoIter = IntoIter<T>;
fn into_iter(self) -> IntoIter<T> {
self.into_vec().into_iter()
}
}
impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> {
type IntoIter = Iter<'a, T>;
fn into_iter(self) -> Iter<'a, T> {
self.as_slice().into_iter()
}
}
///////////////////////////////////////////////////////////////////////////
// Public trait `Subst`
//