Expand description
Utilities for iterating readers efficiently line-by-line over
ASCII or UTF-8 encoded text content. Lines are identified by a
LINE-FEED, i.e. a byte with the value \x0A
. Content at the
end of a stream will be considered as a line - no matter whether
it was termined by a line-feed or not.
Efficiency is achieved by two limitations:
-
The provided utilities avoid allocation of memory for each identified line by reusing internal buffers. Clients are supposed to make their own copy of a line if it needs to be remembered for later use in the program.
-
The provided utilities do not validate proper encoding of the input data, and leave this up to the client.
Modules§
- linemapper
- Implements line-by-line iteration over a given reader by mapping a user defined function over each line.
- linereader
- Iterates over lines of a given reader by keeping an internal buffer which client code is handed a reference to for consumption of the line.
Macros§
- read_
lines - Provides a convenient way to iterate over all lines through a
LineReader
. For an example, refer to the documentation ofLineReader
. The identifier representing the read line will be of typeResult<&[u8]>
. - try_
read_ lines - Provides a convenient way to iterate over all lines through a
LineReader
wrapping the invocation toLineReader::read_line
with atry!
. Hence, the identifer representing the read line will be directly of type&[u8]
.