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

Method from_bytes

atomic-core/tests/inode_graph_test.rs:83–100  ·  view source on GitHub ↗

Decode from bytes.

(bytes: &[u8; 32])

Source from the content-addressed store, hash-verified

81
82 /// Decode from bytes.
83 pub fn from_bytes(bytes: &[u8; 32]) -> Self {
84 let inode = Inode(L64::from_le_bytes([
85 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
86 ]));
87 let change = NodeId(L64::from_le_bytes([
88 bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
89 ]));
90 let start = ChangePosition(L64::from_le_bytes([
91 bytes[16], bytes[17], bytes[18], bytes[19], bytes[20], bytes[21], bytes[22], bytes[23],
92 ]));
93 let end = ChangePosition(L64::from_le_bytes([
94 bytes[24], bytes[25], bytes[26], bytes[27], bytes[28], bytes[29], bytes[30], bytes[31],
95 ]));
96 Self {
97 inode,
98 span: GraphNode { change, start, end },
99 }
100 }
101}
102
103#[test]

Callers

nothing calls this directly

Calls 3

InodeClass · 0.85
NodeIdClass · 0.85
ChangePositionClass · 0.85

Tested by

no test coverage detected