Skip to main content

hex_check_with_case

Function hex_check_with_case 

Source
pub fn hex_check_with_case(src: &[u8], check_case: CheckCase) -> bool
Expand description

Checks ASCII hex digits against an explicit letter-case policy.

Digits are accepted under every CheckCase policy. Empty input succeeds; odd lengths are allowed. Like hex_check, this checks characters only and neither allocates nor modifies the input.

ยงExamples

use faster_hex::{hex_check_with_case, CheckCase};

assert!(hex_check_with_case(b"0123", CheckCase::Upper));
assert!(hex_check_with_case(b"ab01", CheckCase::Lower));
assert!(!hex_check_with_case(b"AB01", CheckCase::Lower));
assert!(hex_check_with_case(b"aB01", CheckCase::None));