Serializes to a fixed-size byte array (Little Endian).
(&self)
| 166 | |
| 167 | /// Serializes to a fixed-size byte array (Little Endian). |
| 168 | pub fn to_bytes(&self) -> [u8; Self::SIZE] { |
| 169 | let mut buf = [0u8; Self::SIZE]; |
| 170 | buf[0..8].copy_from_slice(&self.offset.to_le_bytes()); |
| 171 | buf[8..16].copy_from_slice(&self.length.to_le_bytes()); |
| 172 | buf |
| 173 | } |
| 174 | |
| 175 | /// Deserializes from a fixed-size byte array. |
| 176 | pub fn from_bytes(bytes: &[u8]) -> Result<Self> { |
no outgoing calls
no test coverage detected