(id: &str)
| 85 | } |
| 86 | |
| 87 | pub fn timestamp(id: &str) -> Option<u64> { |
| 88 | let parts: Vec<&str> = id.split('_').collect(); |
| 89 | if parts.len() != 2 { |
| 90 | return None; |
| 91 | } |
| 92 | |
| 93 | let hex = parts[1].get(0..12)?; |
| 94 | let encoded = u64::from_str_radix(hex, 16).ok()?; |
| 95 | Some(encoded / 0x1000) |
| 96 | } |
| 97 | |
| 98 | pub fn validate_prefix(id: &str, expected: Prefix) -> bool { |
| 99 | id.starts_with(expected.as_str()) |