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

Function encode_branch_id

atomic-core/src/crdt/tables.rs:284–289  ·  view source on GitHub ↗
(id: &BranchId)

Source from the content-addressed store, hash-verified

282/// ```
283#[inline]
284pub fn encode_branch_id(id: &BranchId) -> [u8; 12] {
285 let mut bytes = [0u8; 12];
286 bytes[0..8].copy_from_slice(&id.change_id().get().to_le_bytes());
287 bytes[8..12].copy_from_slice(&id.branch_idx().to_le_bytes());
288 bytes
289}
290
291/// Decode a BranchId from 12 bytes.
292#[inline]

Calls 4

to_le_bytesMethod · 0.80
branch_idxMethod · 0.80
getMethod · 0.65
change_idMethod · 0.45