Format `(snapshot_id, element_index)` as the canonical token string. A 4-hex-char snapshot prefix means tokens stay under 12 chars even with 4-digit indices. Snapshot ids are masked to 16 bits by [`TokenRegistry::register_snapshot`] before storage so the round trip `resolve(format_token(id, idx))` closes cleanly without truncation drift. Collision chance inside the 8-entry LRU window is 8/65536 ≈
(snapshot_id: u32, element_index: usize)
| 278 | /// registry treats the `(pid, snapshot_id)` pair as the lookup key so a |
| 279 | /// same-bits collision across pids never aliases. |
| 280 | pub fn format_token(snapshot_id: u32, element_index: usize) -> String { |
| 281 | let short = snapshot_id & 0xffff; |
| 282 | format!("s{short:04x}:{element_index}") |
| 283 | } |
| 284 | |
| 285 | /// Parse a canonical token string into `(snapshot_id, element_index)`. Returns |
| 286 | /// `None` on any shape error (unknown prefix, missing colon, non-hex, |
no outgoing calls