Parse a hex character to `u8`
(b: u8)
| 734 | |
| 735 | /// Parse a hex character to `u8` |
| 736 | fn parse_hex(b: u8) -> Result<u8, ArrowError> { |
| 737 | let digit = char::from(b) |
| 738 | .to_digit(16) |
| 739 | .ok_or_else(|| err(b, "unicode escape"))?; |
| 740 | Ok(digit as u8) |
| 741 | } |
| 742 | |
| 743 | #[cfg(test)] |
| 744 | mod tests { |