78 stable releases

Uses old Rust 2015

5.8.1 Jul 23, 2017
5.7.1 Jan 10, 2017
5.7.0 Sep 1, 2016
5.6.3 Mar 29, 2016
3.3.3 Nov 28, 2014

#1592 in Algorithms

Download history 203/week @ 2024-02-22 97/week @ 2024-02-29 35/week @ 2024-03-07 7/week @ 2024-03-14

342 downloads per month

MIT license

185KB
3K SLoC

Iobuf

A contiguous region of bytes, useful for I/O operations.

crates.io

Build Status

An Iobuf consists of:

  • a buffer
  • limits (a subrange of the buffer)
  • a window (a subrange of the limits)

All iobuf operations are restricted to operate within the limits. Initially, the window of an Iobuf is identical to the limits. If you have an &mut to an Iobuf, you may change the window and limits. If you only have a &, you may not. Similarly, if you have a RWIobuf, you may modify the data in the buffer. If you have a ROIobuf, you may not.

The limits can be narrowed, but never widened. The window may be set to any arbitrary subrange of the limits.

Iobufs are cheap to clone, since the buffers are refcounted. Use this to construct multiple views into the same data.

This started out as a direct port of Jane Street Core's Iobuf module, but has evolved into much more.

Documentation

See the very thorough API Docs.

No runtime deps