(&self)
| 70 | } |
| 71 | |
| 72 | pub fn encode(&self) -> Vec<u8> { |
| 73 | let mut bytes = Vec::with_capacity(KEY_HEADER_SIZE + self.path.len()); |
| 74 | bytes.push(FILE_INDEX_V2_KEY_VERSION); |
| 75 | bytes.extend_from_slice(self.working_copy.as_bytes()); |
| 76 | bytes.extend_from_slice(&self.path); |
| 77 | bytes |
| 78 | } |
| 79 | |
| 80 | pub fn decode(bytes: &[u8]) -> PristineResult<Self> { |
| 81 | if bytes.len() <= KEY_HEADER_SIZE { |