Function decode_to_vec

Source
pub fn decode_to_vec(
    input: &[u8],
    output: &mut Vec<u8>,
) -> Result<usize, DecodeError>
Expand description

Decode the given tick-encoded ASCII input, and append the result to output. Returns the number of bytes appended. Returns an error if the result isn’t a valid ASCII string, or isn’t a valid canonical tick-encoding.

§Example

let mut output = vec![];
let count = tick_encoding::decode_to_vec(b"hello, world! `F0`9F`99`82", &mut output).unwrap();
let output_str = core::str::from_utf8(&output).unwrap();
assert_eq!(output_str, "hello, world! 🙂");
assert_eq!(count, 18);