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: ChildStdinImplementations§
source§impl EngineConnection
impl EngineConnection
sourcepub fn use_uci(&mut self) -> Result<(Option<IdMessageKind>, Vec<OptionMessage>)>
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.
sourcepub fn go(
&mut self,
message: GoMessage
) -> Result<(Vec<InfoMessage>, BestMoveMessage)>
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.
sourcepub fn go_async(
arc_self: Arc<Mutex<Self>>,
message: GoMessage
) -> GuiToEngineUciConnectionGo<impl FnOnce() -> Result<(), GuiToEngineUciConnectionGoError>>
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::gofunction 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.