Struct usi::EngineCommandReader
source · [−]pub struct EngineCommandReader<R: BufRead> { /* private fields */ }
Expand description
EngineCommandReader<R>
produces a structured output from a reader.
Examples
use usi::{BestMoveParams, EngineCommand, EngineCommandReader};
let buf = "usiok\nreadyok\n";
let mut reader = EngineCommandReader::new(buf.as_bytes());
assert_eq!(Some(EngineCommand::UsiOk), *reader.next_command().unwrap().response());
assert_eq!(Some(EngineCommand::ReadyOk), *reader.next_command().unwrap().response());
Implementations
sourceimpl<R: BufRead> EngineCommandReader<R>
impl<R: BufRead> EngineCommandReader<R>
pub fn new(receive: R) -> Self
pub fn next_command(&mut self) -> Result<EngineOutput, Error>
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for EngineCommandReader<R> where
R: RefUnwindSafe,
impl<R> Send for EngineCommandReader<R> where
R: Send,
impl<R> Sync for EngineCommandReader<R> where
R: Sync,
impl<R> Unpin for EngineCommandReader<R> where
R: Unpin,
impl<R> UnwindSafe for EngineCommandReader<R> where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more