[][src]Struct pgn_reader::BufferedReader

pub struct BufferedReader<R> { /* fields omitted */ }

A buffered PGN reader.

Methods

impl<T: AsRef<[u8]>> BufferedReader<Cursor<T>>[src]

pub fn new_cursor(inner: T) -> BufferedReader<Cursor<T>>[src]

Create a new reader by wrapping a byte slice in a Cursor.

use pgn_reader::BufferedReader;

let pgn = b"1. e4 e5 *";
let reader = BufferedReader::new_cursor(&pgn[..]);

impl<R: Read> BufferedReader<R>[src]

pub fn new(inner: R) -> BufferedReader<R>[src]

Create a new buffered PGN reader.

use std::fs::File;
use pgn_reader::BufferedReader;

let file = File::open("example.pgn")?;
let reader = BufferedReader::new(file);

pub fn read_game<V: Visitor>(
    &mut self,
    visitor: &mut V
) -> Result<Option<V::Result>>
[src]

Read a single game, if any, and returns the result produced by the visitor.

Errors

  • I/O error from the underlying reader.
  • Irrecoverable parser errors.

pub fn skip_game<V: Visitor>(&mut self) -> Result<bool>[src]

Skip a single game, if any.

Errors

  • I/O error from the underlying reader.
  • Irrecoverable parser errors.

pub fn read_all<V: Visitor>(&mut self, visitor: &mut V) -> Result<()>[src]

Read all games.

Errors

  • I/O error from the underlying reader.
  • Irrecoverable parser errors.

Important traits for IntoIter<'a, V, R>
pub fn into_iter<V: Visitor>(self, visitor: &mut V) -> IntoIter<V, R>[src]

Create an iterator over all games.

Errors

  • I/O error from the underlying reader.
  • Irrecoverable parser errors.

pub fn into_inner(self) -> Chain<Cursor<Buffer>, R>[src]

Gets the remaining bytes in the buffer and the underlying reader.

Trait Implementations

impl<R: Debug> Debug for BufferedReader<R>[src]

Auto Trait Implementations

impl<R> Sync for BufferedReader<R> where
    R: Sync

impl<R> Send for BufferedReader<R> where
    R: Send

impl<R> Unpin for BufferedReader<R> where
    R: Unpin

impl<R> RefUnwindSafe for BufferedReader<R> where
    R: RefUnwindSafe

impl<R> UnwindSafe for BufferedReader<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]