1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*!
`CharReader` is a buffered reader with some difference with the standard one:

* you can read lines without chocking on an infinite stream without newlines
* you can read lines and not store more than necessary

It's suitable when you'd like to read UTF8 lines and aren't sure the data are kind enough.

You may either read a single char, or read a line.

When reading a line, you pass two parameters:

* the max number of chars you want to get (rest of line will be dropped)
* the max number of chars before giving out with an error (thus protecting against infinite streams)

All errors are io::Error:

* UTF8 errors are of kind `InvalidData`
* Lines exceeding your threshold are of kind `Other`

*/
mod reader;
mod unicode;

#[cfg(test)]
mod tests;

pub use reader::CharReader;