[−][src]Trait utf8_chars::BufReadCharsExt
Extends BufRead
with methods for reading chars.
Provided methods
fn chars(&mut self) -> Chars<'_, Self>ⓘ
Returns an iterator over the chars of this reader.
In contrast to chars_raw
, the error type is
io::Error
, and therefore more likely to be drop-in
compatible, at the price of losing the UTF-8 context bytes in the error
message.
The iterator returned from this function will yield instances of io::Result
<char>
.
fn chars_raw(&mut self) -> CharsRaw<'_, Self>ⓘ
Returns an iterator over the chars of this reader.
The iterator returned from this function will yield instances of Result
<char,
ReadCharError
>
.
fn read_char(&mut self) -> Result<Option<char>>
Reads a char from the underlying reader.
In contrast to read_char_raw
, the error type is
io::Error
, and therefore more likely to be drop-in
compatible, at the price of losing the UTF-8 context bytes in the error
message.
Returns
Ok(Some(char))
if a char has successfully read,Ok(None)
if the stream has reached EOF before any byte was read,Err(err)
if an I/O error occurred, or read byte sequence was not recognised as a valid UTF-8.
If this function encounters an error of the kind io::ErrorKind::Interrupted
then the error is ignored and the operation will continue.
fn read_char_raw(&mut self) -> Result<Option<char>, ReadCharError>
Reads a char from the underlying reader.
Returns
Ok(Some(char))
if a char has successfully read,Ok(None)
if the stream has reached EOF before any byte was read,Err(err)
if an I/O error occurred, or read byte sequence was not recognised as a valid UTF-8.
If this function encounters an error of the kind io::ErrorKind::Interrupted
then the error is ignored and the operation will continue.