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

Function encode_to_slice

Source
pub fn encode_to_slice<T>(
    input: T,
    output: &mut [u8],
) -> Result<(), FromHexError>
where T: AsRef<[u8]>,
Expand description

Encodes some bytes into a mutable slice of bytes.

The output buffer, has to be able to hold at least input.len() * 2 bytes, otherwise this function will return an error.

ยงExample

let mut bytes = [0u8; 4 * 2];

hex::encode_to_slice(b"kiwi", &mut bytes)?;
assert_eq!(&bytes, b"6b697769");