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

Function encode_trunk_id

atomic-core/src/crdt/tables.rs:245–250  ·  view source on GitHub ↗
(id: &TrunkId)

Source from the content-addressed store, hash-verified

243/// ```
244#[inline]
245pub fn encode_trunk_id(id: &TrunkId) -> [u8; 12] {
246 let mut bytes = [0u8; 12];
247 bytes[0..8].copy_from_slice(&id.change_id().get().to_le_bytes());
248 bytes[8..12].copy_from_slice(&id.file_idx().to_le_bytes());
249 bytes
250}
251
252/// Decode a TrunkId from 12 bytes.
253///

Calls 4

to_le_bytesMethod · 0.80
file_idxMethod · 0.80
getMethod · 0.65
change_idMethod · 0.45