(&self)
| 63 | } |
| 64 | |
| 65 | pub fn as_slice(&self) -> Result<&[u8], InvalidHashAlgorithm> { |
| 66 | match HashAlgorithm::from_u32(self.algo) { |
| 67 | Some(algo) => Ok(&self.hash[0..algo.raw_len()]), |
| 68 | None => Err(InvalidHashAlgorithm(self.algo)), |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | pub fn as_mut_slice(&mut self) -> Result<&mut [u8], InvalidHashAlgorithm> { |
| 73 | match HashAlgorithm::from_u32(self.algo) { |
no test coverage detected