pub trait BufReadCharsExt: BufRead {
// Provided methods
fn chars(&mut self) -> Chars<'_, Self> ⓘ { ... }
fn chars_raw(&mut self) -> CharsRaw<'_, Self> ⓘ { ... }
fn read_char(&mut self) -> Result<Option<char>> { ... }
fn read_char_raw(&mut self) -> Result<Option<char>, ReadCharError> { ... }
}Expand description
Extends BufRead with methods for reading chars.
Provided Methods§
Sourcefn chars(&mut self) -> Chars<'_, Self> ⓘ
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>.
Sourcefn chars_raw(&mut self) -> CharsRaw<'_, Self> ⓘ
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>.
Sourcefn read_char(&mut self) -> Result<Option<char>>
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.
Sourcefn read_char_raw(&mut self) -> Result<Option<char>, ReadCharError>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.