reth::primitives::revm_primitives::alloy_primitives::hex

Function check_raw

pub fn check_raw<T>(input: T) -> bool
where T: AsRef<[u8]>,
Expand description

Returns true if the input is a valid hex string.

Note that this does not check prefixes or length, but just the contents of the string.

ยงExamples

assert!(const_hex::check_raw("48656c6c6f20776f726c6421"));

// Odd length, but valid hex
assert!(const_hex::check_raw("48656c6c6f20776f726c642"));

// Valid hex string, but the prefix is not valid
assert!(!const_hex::check_raw("0x48656c6c6f20776f726c6421"));

assert!(!const_hex::check_raw("Hello world!"));