cast::revm::interpreter::primitives::alloy_primitives::hex

Function check

pub fn check<T>(input: T) -> Result<(), FromHexError>
where T: AsRef<[u8]>,
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());