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

Function vertex_from_bytes

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

Decode a Span from 24 bytes.

(bytes: &[u8; 24])

Source from the content-addressed store, hash-verified

238
239/// Decode a Span from 24 bytes.
240fn vertex_from_bytes(bytes: &[u8; 24]) -> GraphNode<NodeId> {
241 let change = NodeId(L64::from_le_bytes([
242 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
243 ]));
244 let start = ChangePosition(L64::from_le_bytes([
245 bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
246 ]));
247 let end = ChangePosition(L64::from_le_bytes([
248 bytes[16], bytes[17], bytes[18], bytes[19], bytes[20], bytes[21], bytes[22], bytes[23],
249 ]));
250 GraphNode { change, start, end }
251}
252
253#[test]
254fn test_vertex_bytes_roundtrip() {

Callers 1

Calls 2

NodeIdClass · 0.85
ChangePositionClass · 0.85

Tested by

no test coverage detected