1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crateUnit;
// #[inline(always)]
// fn distance<C>(a_start: &C, a_end: &C, b_start: &C, b_end: &C) -> DirectedDistance<C>
// where
// C: Unit,
// {
// if overlaps_with(a_start, a_end, b_start, b_end) {
// DirectedDistance::Overlaps
// } else {
// match a_end.cmp(b_start) {
// Ordering::Less => {
// // a is upstream of b.
// DirectedDistance::Upstream(*b_start - *a_end)
// }
// Ordering::Equal => {
// match a_start.cmp(b_end) {
// Ordering::Less => DirectedDistance::Upstream(C::zero()),
// Ordering::Equal => panic!(
// "Both coordinates are equal should have been caught with the previous `overlaps_with` test!"
// ),
// Ordering::Greater => DirectedDistance::Downstream(C::zero()),
// }
// },
// Ordering::Greater => {
// // a is downstream of b.
// DirectedDistance::Downstream(*a_start - *b_end)
// }
// }
// }
// }