pub fn encode_into<'a, B>(bytes: B, output: &mut [u8]) -> Result<usize, Error>Expand description
Encodes bytes as Crockford Base32 into a provided output buffer.
§Returns
Ok(usize): The number of bytes written to the output buffer.Err(Error): If any errors occur during the encoding process.
§Errors
Error::InvalidBufferSizeif the output buffer is too small.
§Examples
let bytes = b"usque ad finem";
// allocate a buffer with enough capacity
let mut buffer = [0; 32];
// encode bytes into the buffer
let written = c32::encode_into(bytes, &mut buffer)?;
let expected = b"1TQ6WBNCMG62S10CSMPWSBD";
assert_eq!(&buffer[..written], expected);