Encode as bytes for use as a redb key. Layout: [inode: 8 bytes][change: 8 bytes][start: 8 bytes][end: 8 bytes]
(&self)
| 71 | /// Encode as bytes for use as a redb key. |
| 72 | /// Layout: [inode: 8 bytes][change: 8 bytes][start: 8 bytes][end: 8 bytes] |
| 73 | pub fn to_bytes(&self) -> [u8; 32] { |
| 74 | let mut bytes = [0u8; 32]; |
| 75 | bytes[0..8].copy_from_slice(&self.inode.0.to_le_bytes()); |
| 76 | bytes[8..16].copy_from_slice(&self.span.change.0.to_le_bytes()); |
| 77 | bytes[16..24].copy_from_slice(&self.span.start.0.to_le_bytes()); |
| 78 | bytes[24..32].copy_from_slice(&self.span.end.0.to_le_bytes()); |
| 79 | bytes |
| 80 | } |
| 81 | |
| 82 | /// Decode from bytes. |
| 83 | pub fn from_bytes(bytes: &[u8; 32]) -> Self { |
no test coverage detected