(data: &str)
| 26 | } |
| 27 | |
| 28 | fn decode_hex(data: &str) -> io::Result<Vec<u8>> { |
| 29 | if data.len() % 2 != 0 { |
| 30 | let msg = "Invalid hex string: length is not even"; |
| 31 | return Err(io::Error::new(io::ErrorKind::InvalidData, msg)); |
| 32 | } |
| 33 | data.as_bytes() |
| 34 | .chunks_exact(2) |
| 35 | .map(|chunk| { |
| 36 | let a = decode_hex_char(chunk[0])?; |
| 37 | let b = decode_hex_char(chunk[1])?; |
| 38 | Ok((a << 4) | b) |
| 39 | }) |
| 40 | .collect() |
| 41 | } |
| 42 | |
| 43 | fn encode(reader: impl BufRead, mut writer: impl Write) -> io::Result<usize> { |
| 44 | let mut blobs = Vec::new(); |
no test coverage detected