(&self, k: K)
| 67 | } |
| 68 | |
| 69 | fn within_bound(&self, k: K) -> bool { |
| 70 | match (self.lower_bound(), self.upper_bound()) { |
| 71 | (Some(lower), Some(upper)) => lower <= k && k <= upper, |
| 72 | (None, None) => false, |
| 73 | // other states are not reachable, even if there is one entry, both upper and |
| 74 | // lower bounds should be the same, both should be Some. |
| 75 | _ => unreachable!(), |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | pub fn get_value(&self, key: K) -> Option<&V> { |
| 80 | if !self.within_bound(key) { |
no test coverage detected