UciMessage

Enum UciMessage 

Source
pub enum UciMessage {
Show 20 variants Uci, Debug(bool), IsReady, Register { later: bool, name: Option<String>, code: Option<String>, }, Position { startpos: bool, fen: Option<UciFen>, moves: Vec<UciMove>, }, SetOption { name: String, value: Option<String>, }, UciNewGame, Stop, PonderHit, Quit, Go { time_control: Option<UciTimeControl>, search_control: Option<UciSearchControl>, }, Id { name: Option<String>, author: Option<String>, }, UciOk, ReadyOk, BestMove { best_move: UciMove, ponder: Option<UciMove>, }, CopyProtection(ProtectionState), Registration(ProtectionState), Option(UciOptionConfig), Info(Vec<UciInfoAttribute>), Unknown(String, Option<Error<Rule>>),
}
Expand description

An enumeration type containing representations for all messages supported by the UCI protocol.

Variants§

§

Uci

The uci engine-bound message.

§

Debug(bool)

The debug engine-bound message. Its internal property specifies whether debug mode should be enabled (true), or disabled (false).

§

IsReady

The isready engine-bound message.

§

Register

The register engine-bound message.

Fields

§later: bool

The register later engine-bound message.

§name: Option<String>

The name part of the register <code> <name> engine-bound message.

§code: Option<String>

The code part of the register <code> <name> engine-bound message.

§

Position

The position engine-bound message.

Fields

§startpos: bool

If true, it denotes the starting chess position. Generally, if this property is true, then the value of the fen property will be None.

§fen: Option<UciFen>

The FEN format representation of a chess position.

§moves: Vec<UciMove>

A list of moves to apply to the position.

§

SetOption

The setoption engine-bound message.

Fields

§name: String

The name of the option to set.

§value: Option<String>

The value of the option to set. If the option has no value, this should be None.

§

UciNewGame

The ucinewgame engine-bound message.

§

Stop

The stop engine-bound message.

§

PonderHit

The ponderhit engine-bound message.

§

Quit

The quit engine-bound message.

§

Go

The go engine-bound message.

Fields

§time_control: Option<UciTimeControl>

Time-control-related go parameters (sub-commands).

§search_control: Option<UciSearchControl>

Search-related go parameters (sub-commands).

§

Id

The id GUI-bound message.

Fields

§name: Option<String>

The name of the engine, possibly including the version.

§author: Option<String>

The name of the author of the engine.

§

UciOk

The uciok GUI-bound message.

§

ReadyOk

The readyok GUI-bound message.

§

BestMove

The bestmove GUI-bound message.

Fields

§best_move: UciMove

The move the engine thinks is the best one in the position.

§ponder: Option<UciMove>

The move the engine would like to ponder on.

§

CopyProtection(ProtectionState)

The copyprotection GUI-bound message.

§

Registration(ProtectionState)

The registration GUI-bound message.

§

Option(UciOptionConfig)

The option GUI-bound message.

§

Info(Vec<UciInfoAttribute>)

The info GUI-bound message.

§

Unknown(String, Option<Error<Rule>>)

Indicating unknown message.

Implementations§

Source§

impl UciMessage

Source

pub fn register_later() -> UciMessage

Constructs a register later UciMessage::Register message.

Source

pub fn register_code(name: &str, code: &str) -> UciMessage

Constructs a register <code> <name> UciMessage::Register message.

Source

pub fn go() -> UciMessage

Constructs an empty UciMessage::Register message.

Source

pub fn go_ponder() -> UciMessage

Construct a go ponder UciMessage::Register message.

Source

pub fn go_infinite() -> UciMessage

Constructs a go infinite UciMessage::Register message.

Source

pub fn go_movetime(milliseconds: Duration) -> UciMessage

Constructs a go movetime <milliseconds> UciMessage::Register message, with milliseconds as the argument.

Source

pub fn id_name(name: &str) -> UciMessage

Constructs an id <name> GUI-bound message.

Source

pub fn id_author(author: &str) -> UciMessage

Constructs an id <name> GUI-bound message.

Source

pub fn best_move(best_move: UciMove) -> UciMessage

Constructs a bestmove GUI-bound message without the ponder move.

Source

pub fn best_move_with_ponder(best_move: UciMove, ponder: UciMove) -> UciMessage

Constructs a bestmove GUI-bound message with the ponder move.

Source

pub fn info_string(s: String) -> UciMessage

Constructs an info string ... message.

Source

pub fn direction(&self) -> CommunicationDirection

Returns whether the command was meant for the engine or for the GUI.

Source

pub fn as_bool(&self) -> Option<bool>

If this UciMessage is a UciMessage::SetOption and the value of that option is a bool, this method returns the bool value, otherwise it returns None.

Source

pub fn as_i32(&self) -> Option<i32>

If this UciMessage is a UciMessage::SetOption and the value of that option is an integer, this method returns the i32 value of the integer, otherwise it returns None.

Source

pub fn is_unknown(&self) -> bool

Return true if this UciMessage is of variant UnknownMessage.

Trait Implementations§

Source§

impl AsRef<UciMessage> for ByteVecUciMessage

Source§

fn as_ref(&self) -> &UciMessage

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for UciMessage

Source§

fn clone(&self) -> UciMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UciMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for UciMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl From<UciMessage> for ByteVecUciMessage

Source§

fn from(m: UciMessage) -> Self

Converts to this type from the input type.
Source§

impl Hash for UciMessage

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Into<UciMessage> for ByteVecUciMessage

Source§

fn into(self) -> UciMessage

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for UciMessage

Source§

fn eq(&self, other: &UciMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serializable for UciMessage

Source§

fn serialize(&self) -> String

Serializes the command into a String.

§Examples
use vampirc_uci::{UciMessage, Serializable};

println!("{}", UciMessage::Uci.serialize()); // Should print `uci`.
Source§

impl Eq for UciMessage

Source§

impl StructuralPartialEq for UciMessage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.