Pre: implement IntoIterator for ValueTypeSet.
This commit is contained in:
parent
5d5e85bcba
commit
03c0930285
1 changed files with 25 additions and 0 deletions
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue