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

Function decode_branch_id

atomic-core/src/crdt/tables.rs:293–297  ·  view source on GitHub ↗
(bytes: &[u8; 12])

Source from the content-addressed store, hash-verified

291/// Decode a BranchId from 12 bytes.
292#[inline]
293pub fn decode_branch_id(bytes: &[u8; 12]) -> BranchId {
294 let change_id = NodeId::new(u64::from_le_bytes(bytes[0..8].try_into().unwrap()));
295 let branch_idx = u32::from_le_bytes(bytes[8..12].try_into().unwrap());
296 BranchId::new(change_id, branch_idx)
297}
298
299/// Encode a LeafId as 12 bytes for storage.
300///

Calls 1

unwrapMethod · 0.45

Tested by 3