add the keys between lo and hi in the subtree rooted at x to the queue
(
x: Option<NonNull<Node<K, V>>>,
queue: &mut Vec<&'a K>,
lo: &K,
hi: &K,
)
| 284 | /// add the keys between lo and hi in the subtree rooted at x |
| 285 | /// to the queue |
| 286 | pub fn keys<'a, K: 'a, V: 'a>( |
| 287 | x: Option<NonNull<Node<K, V>>>, |
| 288 | queue: &mut Vec<&'a K>, |
| 289 | lo: &K, |
| 290 | hi: &K, |
| 291 | ) where |
| 292 | K: Ord, |
| 293 | { |
| 294 | let x = NodeQuery::new(x); |
| 295 | if x.is_some() { |
| 296 | let xkey = x.get_key().unwrap(); |
| 297 | let cmplo = lo.cmp(xkey); |
| 298 | let cmphi = hi.cmp(xkey); |
| 299 | if cmplo.is_lt() { |
| 300 | keys(x.left().node, queue, lo, hi); |
| 301 | } |
| 302 | if cmplo.is_le() && cmphi.is_ge() { |
| 303 | queue.push(xkey); |
| 304 | } |
| 305 | if cmphi.is_gt() { |
| 306 | keys(x.right().node, queue, lo, hi); |
| 307 | } |
| 308 | } |
| 309 | } |