| 106 | } |
| 107 | |
| 108 | fn may_contain(&self, value: Datum<'a>) -> bool { |
| 109 | match self { |
| 110 | Values::Empty => false, |
| 111 | Values::Within(min, max) => *min <= value && value <= *max, |
| 112 | Values::All => true, |
| 113 | Values::Nested(field_map) => match value { |
| 114 | Datum::Map(datum_map) => { |
| 115 | datum_map |
| 116 | .iter() |
| 117 | .all(|(key, val)| match field_map.get(&key.into()) { |
| 118 | None => true, |
| 119 | Some(nested) => nested.may_contain(val), |
| 120 | }) |
| 121 | } |
| 122 | _ => false, |
| 123 | }, |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /// Returns the sole datum in this value set, if it is known to be a single |
| 128 | /// value. Returns `None` otherwise (for empty sets, ranges with distinct |