Pre: add helpers to ValueTypeSet.
This commit is contained in:
parent
9a12ced317
commit
dbbbd220f9
1 changed files with 18 additions and 0 deletions
|
@ -525,9 +525,27 @@ impl ValueTypeSet {
|
|||
pub fn of_numeric_types() -> ValueTypeSet {
|
||||
ValueTypeSet(EnumSet::of_both(ValueType::Double, ValueType::Long))
|
||||
}
|
||||
|
||||
/// Return a set containing `Ref` and `Keyword`.
|
||||
pub fn of_keywords() -> ValueTypeSet {
|
||||
ValueTypeSet(EnumSet::of_both(ValueType::Ref, ValueType::Keyword))
|
||||
}
|
||||
|
||||
/// Return a set containing `Ref` and `Long`.
|
||||
pub fn of_longs() -> ValueTypeSet {
|
||||
ValueTypeSet(EnumSet::of_both(ValueType::Ref, ValueType::Long))
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueTypeSet {
|
||||
pub fn insert(&mut self, vt: ValueType) -> bool {
|
||||
self.0.insert(vt)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
||||
/// Returns a set containing all the types in this set and `other`.
|
||||
pub fn union(&self, other: &ValueTypeSet) -> ValueTypeSet {
|
||||
ValueTypeSet(self.0.union(other.0))
|
||||
|
|
Loading…
Reference in a new issue