Skip to main content

decode_in_place

Function decode_in_place 

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

Decode a tick-encoded ASCII string in-place.

Takes a byte slice containing a tick-encoded ASCII string, and decodes it in-place, writing back into the same byte slice. Returns a sub-slice containing just the decoded bytes (the bytes past the returned sub-slice are left unchanged).

§Errors

Returns a DecodeError if the input is not valid tick-encoded data.

§Example

let mut buffer = b"bytes: `00`01`02`03".to_vec();
let decoded = tick_encoding::decode_in_place(&mut buffer).unwrap();
assert_eq!(decoded, b"bytes: \x00\x01\x02\x03");