Order `rows` by `key` (the local body's twin of the service's listing sort), with id as the tiebreak. `reverse` flips the key, not the tiebreak.
(rows: &mut [Row], key: IntentSort, reverse: bool)
| 112 | /// sort), with id as the tiebreak. `reverse` flips the key, |
| 113 | /// not the tiebreak. |
| 114 | pub(crate) fn sort_rows(rows: &mut [Row], key: IntentSort, reverse: bool) { |
| 115 | rows.sort_by(|a, b| { |
| 116 | let ord = match key { |
| 117 | IntentSort::Id => a.human_key.cmp(&b.human_key), |
| 118 | IntentSort::HumanKey => compare_human_keys(&a.human_key, &b.human_key), |
| 119 | IntentSort::Title => a.title.cmp(&b.title), |
| 120 | IntentSort::Status => a.status.cmp(&b.status), |
| 121 | IntentSort::Kind => a.kind.cmp(&b.kind), |
| 122 | IntentSort::Attested => a.attested.cmp(&b.attested), |
| 123 | IntentSort::Verifies => a.verifies.cmp(&b.verifies), |
| 124 | }; |
| 125 | if reverse { ord.reverse() } else { ord }.then_with(|| a.human_key.cmp(&b.human_key)) |
| 126 | }); |
| 127 | } |
| 128 | |
| 129 | /// Compare the last key component numerically without imposing an integer limit. |
| 130 | /// Invalid suffixes remain deterministic and group with their own prefix. |