MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / hex_bytes

Function hex_bytes

atomic-cli/src/commands/git/parallel.rs:337–348  ·  view source on GitHub ↗

Hex-encode raw bytes (`""` when absent) for the hashed fact records.

(bytes: Option<&[u8]>)

Source from the content-addressed store, hash-verified

335
336/// Hex-encode raw bytes (`""` when absent) for the hashed fact records.
337pub(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).

Callers 2

foreign_commit_factsFunction · 0.70

Calls 2

lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected