[][src]Module ordcode::bytes_esc

Prefix-free encoding and decoding of byte sequences, with escaping

Byte value 0xF8 is escaped as { 0xF8, 0xFF } for ascending order, { 0x07, 0x00 } for descending order. Sequence is terminated by { 0xF8, 0x01 } for ascending order, { 0x07, 0xFE } for descending order. Escaped byte value 0xF8 is chosen because it does not appear in valid UTF-8, and escaping zero is impractical (it is too common)

Functions

bytes_length

Calculate length of pending byte sequence from reader

deserialize_bytes_noesc_to_string

Deserialize input buffer as ordered bytes to String, no escaping and termination sequences

deserialize_bytes_noesc_to_vec

Deserialize input buffer as ordered byte string, no escaping and termination sequences

deserialize_bytes_noesc_to_writer

Deserialize input buffer as ordered byte string into writer, no escaping and termination sequences

deserialize_bytes_to_vec

Deserialize escaped byte sequence

deserialize_bytes_to_writer

Deserialize escaped byte sequence and write result to WriteBytes

serialize_bytes

Serialize byte sequence to escaped representation

serialize_bytes_noesc

Serialize whole input buffer as ordered byte string, no escaping and termination sequences

write_complement_bytes

Write 0xFF bitwise complement of input