Encode a Span as 24 bytes for use as a redb key.
(v: &GraphNode<NodeId>)
| 229 | |
| 230 | /// Encode a Span as 24 bytes for use as a redb key. |
| 231 | fn vertex_to_bytes(v: &GraphNode<NodeId>) -> [u8; 24] { |
| 232 | let mut bytes = [0u8; 24]; |
| 233 | bytes[0..8].copy_from_slice(&v.change.0.to_le_bytes()); |
| 234 | bytes[8..16].copy_from_slice(&v.start.0.to_le_bytes()); |
| 235 | bytes[16..24].copy_from_slice(&v.end.0.to_le_bytes()); |
| 236 | bytes |
| 237 | } |
| 238 | |
| 239 | /// Decode a Span from 24 bytes. |
| 240 | fn vertex_from_bytes(bytes: &[u8; 24]) -> GraphNode<NodeId> { |
no test coverage detected