Retrieves the value of the next hexadecimal digit in `iter`, if the next byte is a valid hexadecimal digit.
(iter: &mut I)
| 33 | /// Retrieves the value of the next hexadecimal digit in `iter`, if the next |
| 34 | /// byte is a valid hexadecimal digit. |
| 35 | fn next_hex<I>(iter: &mut I) -> Option<u8> |
| 36 | where |
| 37 | I: Iterator<Item = u8>, |
| 38 | { |
| 39 | iter.next().and_then(|c| match c { |
| 40 | b'A'..=b'F' => Some(c - b'A' + 10), |
| 41 | b'a'..=b'f' => Some(c - b'a' + 10), |
| 42 | b'0'..=b'9' => Some(c - b'0'), |
| 43 | _ => None, |
| 44 | }) |
| 45 | } |