[][src]Trait utf8_chars::BufReadCharsExt

pub trait BufReadCharsExt: BufRead {
    fn chars(&mut self) -> Chars<'_, Self>

Notable traits for Chars<'a, T>

impl<'a, T: BufRead + ?Sized> Iterator for Chars<'a, T> type Item = Result<char>;
{ ... }
fn chars_raw(&mut self) -> CharsRaw<'_, Self>

Notable traits for CharsRaw<'a, T>

impl<'a, T: BufRead + ?Sized> Iterator for CharsRaw<'a, T> type Item = Result<char, ReadCharError>;
{ ... }
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>

Notable traits for Chars<'a, T>

impl<'a, T: BufRead + ?Sized> Iterator for Chars<'a, T> type Item = Result<char>;

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>

Notable traits for CharsRaw<'a, T>

impl<'a, T: BufRead + ?Sized> Iterator for CharsRaw<'a, T> type Item = Result<char, ReadCharError>;

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.

Loading content...

Implementors

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

Loading content...