[][src]Trait utf8_chars::BufReadCharsExt

pub trait BufReadCharsExt: BufRead {
    fn chars(&mut self) -> Chars<Self> { ... }
fn chars_raw(&mut self) -> CharsRaw<Self> { ... }
fn io_chars(&mut self) -> IoChars<Self> { ... }
fn read_char(&mut self) -> Result<Option<char>> { ... }
fn read_char_raw(&mut self) -> Result<Option<char>, ReadCharError> { ... } }

Extends BufRead with methods for reading chars.

Provided methods

fn chars(&mut self) -> Chars<Self>

👎 Deprecated:

Use chars_raw instead. The chars method will be deleted to free this name for other use.

Returns an iterator over the chars of this reader.

The iterator returned from this function will yield instances of Result<char, ReadCharError>.

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 io_chars(&mut self) -> IoChars<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 read_char(&mut self) -> Result<Option<char>>

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.

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.

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.

Loading content...

Implementors

impl<T: BufRead + ?Sized> BufReadCharsExt for T[src]

Loading content...