Pre: implement IntoIterator for ValueTypeSet.

This commit is contained in:
Richard Newman 2017-06-12 14:23:41 -07:00
parent 5d5e85bcba
commit 03c0930285

View file

@ -582,3 +582,28 @@ impl ValueTypeSet {
self.0.len() == 1 self.0.len() == 1
} }
} }
impl IntoIterator for ValueTypeSet {
type Item = ValueType;
type IntoIter = ::enum_set::Iter<ValueType>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl ::std::iter::FromIterator<ValueType> for ValueTypeSet {
fn from_iter<I: IntoIterator<Item = ValueType>>(iterator: I) -> Self {
let mut ret = Self::none();
ret.0.extend(iterator);
ret
}
}
impl ::std::iter::Extend<ValueType> for ValueTypeSet {
fn extend<I: IntoIterator<Item = ValueType>>(&mut self, iter: I) {
for element in iter {
self.0.insert(element);
}
}
}