pub fn encode_bytes_to_slice(
bytes: &[u8],
case: HexCase,
out: &mut [u8],
) -> Result<()>Expand description
Writes the hex encoding of bytes into out.
This is for callers that already own a pre-sized buffer (for example a
slice of a larger, pre-allocated output array) and want to write directly
into it rather than appending to a Vec.
Returns an internal error if out is not exactly 2 * bytes.len() bytes
long, without filling any of the out buffer.
ยงExample
use datafusion_common::utils::hex::{HexCase, encode_bytes_to_slice};
let mut out = [0u8; 8];
encode_bytes_to_slice(&[0xde, 0xad, 0xbe, 0xef], HexCase::Lower, &mut out)?;
assert_eq!(&out, b"deadbeef");