| 1 |
bufio: buffered I/O primitives |
| 2 |
|
| 3 |
bufio provides an [[io::stream]] implementation which provides buffered I/O |
| 4 |
support, utility functions which pair well with buffered streams, and a |
| 5 |
[[scanner]] type which allocates and maintains its own read buffer. |
| 6 |
|
| 7 |
A buffered [[stream]] is used to batch read and write operations against an |
| 8 |
underlying [[io::handle]]. bufio provides several utilities for reading from |
| 9 |
handles, namely [[read_tok]] et al. These functions require small, frequent |
| 10 |
reads, or take advantage of look-ahead, and thus are most efficient when paired |
| 11 |
with a buffered [[stream]]. |
| 12 |
|
| 13 |
bufio also provides a "scanning" interface, with functions like [[scan_string]] |
| 14 |
which take in a [[scanner]]. Strings returned from scanning functions are |
| 15 |
borrowed from the scanner's read buffer, so allocated memory can be reused for |
| 16 |
future scans. |