const_hex

Function check

Source
pub fn check<T: AsRef<[u8]>>(input: T) -> Result<(), FromHexError>
Expand description

Returns true if the input is a valid hex string and can be decoded successfully.

ยงExamples

assert!(const_hex::check("48656c6c6f20776f726c6421").is_ok());
assert!(const_hex::check("0x48656c6c6f20776f726c6421").is_ok());

assert!(const_hex::check("48656c6c6f20776f726c642").is_err());
assert!(const_hex::check("Hello world!").is_err());