pub fn decode(input: &[u8]) -> Result<Cow<'_, [u8]>, DecodeError>
Expand description
Decode the given encoded input into a byte array. If no bytes need to be un-escapeed, then the result will be borrowed from the input.
Returns an error if the input isn’t a valid ASCII string, or isn’t a valid canonical tick-encoding.
§Example
let decoded = tick_encoding::decode(b"hello world!").unwrap();
assert_eq!(decoded, "hello world!".as_bytes());
let decoded = tick_encoding::decode(b"`00`FF").unwrap();
assert_eq!(decoded, [0x00, 0xFF].as_slice());