`find_block` query against a loaded span set. Spans within a change do not overlap, so the candidate containing `target` is the greatest-start non-empty span with `start <= target`; if its range doesn't contain `target`, no non-empty span does. Falls back to an empty marker at exactly `target`.
(set: &BTreeSet<(u64, u64)>, target: u64)
| 61 | /// doesn't contain `target`, no non-empty span does. Falls back to an empty |
| 62 | /// marker at exactly `target`. |
| 63 | fn block(set: &BTreeSet<(u64, u64)>, target: u64) -> Option<(u64, u64)> { |
| 64 | for &(s, e) in set.range(..=(target, u64::MAX)).rev() { |
| 65 | if s == e { |
| 66 | continue; |
| 67 | } |
| 68 | if s <= target && target < e { |
| 69 | return Some((s, e)); |
| 70 | } |
| 71 | break; |
| 72 | } |
| 73 | if set.contains(&(target, target)) { |
| 74 | return Some((target, target)); |
| 75 | } |
| 76 | None |
| 77 | } |
| 78 | |
| 79 | /// `find_block_end` query against a loaded span set. |
| 80 | /// |
no test coverage detected