#io-read #read-write #string #io-write #reading #methods #length

rwutil

Extends io::{Read,Write} with methods for reading length-prefixed strings

6 releases (3 stable)

Uses old Rust 2015

2.0.0 Jun 10, 2017
1.0.1 Feb 25, 2016
0.4.0 Feb 25, 2016
0.3.1 Feb 25, 2016
0.3.0 Feb 25, 2016

#63 in #io-write

MIT license

10KB
193 lines

Read/Write traits for reading common formats like length-prefixed packets.

rwutils handles a few common formats of binary data:

  • C-style strings, that is 0-terminated sequences of non-zero bytes inside the bytes0 module. Check its docs for examples of reading Strings.
  • Length prefixed packets, a u8/u16/u32/u64 of the number of bytes to read, followed by the actual data. See length_prefix.

All readers are implemented as additional traits for the io::Read and io::Write. After using them, additional methods become available on these types.

Please read the notes regarding security in module as well, especially if you are handling untrusted user input.

Dependencies

~120KB