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

Function encode_leaf_value

atomic-core/src/crdt/tables.rs:633–642  ·  view source on GitHub ↗
(data: &SerializedLeaf)

Source from the content-addressed store, hash-verified

631/// ```
632#[inline]
633pub fn encode_leaf_value(data: &SerializedLeaf) -> [u8; 22] {
634 let mut bytes = [0u8; 22];
635 let branch_bytes = encode_branch_id(&data.branch_id);
636 bytes[0..12].copy_from_slice(&branch_bytes);
637 bytes[12] = encode_token_kind(data.kind);
638 bytes[13] = encode_leaf_state(data.state);
639 bytes[14..18].copy_from_slice(&data.content_start.to_le_bytes());
640 bytes[18..22].copy_from_slice(&data.content_end.to_le_bytes());
641 bytes
642}
643
644/// Decode leaf data from 22 bytes.
645#[inline]

Calls 4

encode_branch_idFunction · 0.85
encode_token_kindFunction · 0.85
encode_leaf_stateFunction · 0.85
to_le_bytesMethod · 0.80