Type Alias ruci::EngineConnection

source ·
pub type EngineConnection = UciConnection<GuiMessage, EngineMessage>;
Expand description

A connection to an engine, used by a GUI.

Aliased Type§

struct EngineConnection {
    pub process: Child,
    pub stdout: ChildStdout,
    pub stdin: ChildStdin,
    /* private fields */
}

Fields§

§process: Child§stdout: ChildStdout§stdin: ChildStdin

Implementations§

source§

impl EngineConnection

source

pub fn use_uci(&mut self) -> Result<(Option<IdMessageKind>, Vec<OptionMessage>)>

Sends the GuiMessage::UseUci message and returns the engine’s ID and a vector of options once the uciok message is received.

§Errors

See Write::write_all.

source

pub fn go( &mut self, message: GoMessage ) -> Result<(Vec<InfoMessage>, BestMoveMessage)>

Sends the go message to the engine and waits for the bestmove message response, returning it, along with a list of info messages.

See also the Self::go_async function, which can be interrupted.

§Errors
  • Writing (sending the message) errored.
  • Reading (reading back the responses) errored.
source

pub fn go_async( arc_self: Arc<Mutex<Self>>, message: GoMessage ) -> GuiToEngineUciConnectionGo<impl FnOnce() -> Result<(), GuiToEngineUciConnectionGoError>>

Sends the go message to the engine and waits for the bestmove message response, returning it. The info messages are sent through the returned receiver.

See also:

  • The Self::go function for a simpler alternative, but one that cannot be interrupted.
  • The go_stop example.
§Errors
  • Writing (sending the message) errored.
  • Reading (reading back the responses) errored.
source

pub fn is_ready(&mut self) -> Result<()>

Sends the isready message and waits for the readyok response.

§Errors
  • Writing (sending the message) errored.
  • Reading (reading until readyok) errored.