1 // Adapted from https://github.com/Alexhuszagh/rust-lexical. 2 3 //! Helpers to convert and add digits from characters. 4 5 // Convert u8 to digit. 6 #[inline] to_digit(c: u8) -> Option<u32>7pub(crate) fn to_digit(c: u8) -> Option<u32> { 8 (c as char).to_digit(10) 9 } 10 11 // Add digit to mantissa. 12 #[inline] add_digit(value: u64, digit: u32) -> Option<u64>13pub(crate) fn add_digit(value: u64, digit: u32) -> Option<u64> { 14 value.checked_mul(10)?.checked_add(digit as u64) 15 } 16