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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! OSM element ID value semantics: canonical sort order and blob-range key
//! derivation.
//!
//! OSM IDs are signed `i64`. The canonical osmium sort order is `0` first,
//! then negative IDs by ascending absolute value (`-1, -2, -3, ...`), then
//! positive IDs (`1, 2, 3, ...`). For positive-only IDs (all production
//! PBFs), this collapses to plain `i64` comparison.
//!
//! Distinct from the membership/cardinality concerns in [`crate::idset`]:
//! this module is pure value semantics, no data structure.
/// Sort key for OSM element IDs in canonical order.
///
/// Order: 0, then negative IDs by ascending absolute value (-1, -2, -3, ...),
/// then positive IDs (1, 2, 3, ...). Matches libosmium's sort comparator.
///
/// For positive-only IDs (all production PBFs), this is equivalent to plain
/// i64 comparison - the `(2, id)` tuple compares identically to raw `id`.
pub
/// Compare two OSM element IDs in canonical sort order.
pub
/// OSM-order "first" key for a blob's numeric ID range.
///
/// Used by blob-level sort to determine blob ordering. Conservative for
/// mixed-sign ranges (assumes 0 is present).
pub
/// OSM-order "last" key for a blob's numeric ID range.
///
/// Used by blob-level overlap detection.
pub
/// The ID of the "first" element of a blob in OSM sort order.
///
/// For positive-only blobs, this is min_id. For negative-only blobs,
/// this is max_id (closest to 0). For mixed blobs, conservatively 0.
pub