Hex-encode raw bytes (`""` when absent) for the hashed fact records.
(bytes: Option<&[u8]>)
| 335 | |
| 336 | /// Hex-encode raw bytes (`""` when absent) for the hashed fact records. |
| 337 | pub(crate) fn hex_bytes(bytes: Option<&[u8]>) -> String { |
| 338 | const HEX: &[u8; 16] = b"0123456789abcdef"; |
| 339 | let Some(bytes) = bytes else { |
| 340 | return String::new(); |
| 341 | }; |
| 342 | let mut out = String::with_capacity(bytes.len() * 2); |
| 343 | for byte in bytes { |
| 344 | out.push(HEX[(byte >> 4) as usize] as char); |
| 345 | out.push(HEX[(byte & 0x0f) as usize] as char); |
| 346 | } |
| 347 | out |
| 348 | } |
| 349 | |
| 350 | /// Build the staged post-assembly expectation for one parsed commit (review |
| 351 | /// blocker 2 / R3). |
no test coverage detected