Function const_check
pub const fn const_check(input: &[u8]) -> Result<(), FromHexError>
Expand description
Returns true
if the input is a valid hex string and can be decoded successfully.
Prefer using check
instead when possible (at runtime), as it is likely to be faster.
ยงExamples
const _: () = {
assert!(const_hex::const_check(b"48656c6c6f20776f726c6421").is_ok());
assert!(const_hex::const_check(b"0x48656c6c6f20776f726c6421").is_ok());
assert!(const_hex::const_check(b"48656c6c6f20776f726c642").is_err());
assert!(const_hex::const_check(b"Hello world!").is_err());
};