Struct UsiAgent

Source
pub struct UsiAgent<T, E>
where T: USIPlayer<E> + Debug + Send + 'static, E: PlayerError, EventHandlerError<SystemEventKind, E>: From<E>,
{ /* private fields */ }
Expand description

USIプロトコルをイベントシステムを用いてやり取りするための機能の実装

Implementations§

Source§

impl<T, E> UsiAgent<T, E>
where T: USIPlayer<E> + Debug + Send + 'static, E: PlayerError, EventHandlerError<SystemEventKind, E>: From<E>,

Source

pub fn new(player: T) -> UsiAgent<T, E>
where T: USIPlayer<E> + Debug, Arc<Mutex<T>>: Send + 'static, E: Error + Debug,

UsiAgentの生成

§Arguments
  • player - プレイヤーオブジェクト
Source

pub fn start_default<F>( &self, on_error: F, ) -> Result<(), USIAgentRunningError<'_, SystemEventQueue, E>>

デフォルト設定で開始(ログファイルのパスlogs/log.txt,ログをファイルに記録)

§Arguments
  • on_error - エラー発生時に呼ばれるコールバック関数。エラーオブジェクトへの参照とロガーが渡される。
Source

pub fn start_with_log_path<F>( &self, path: String, on_error: F, ) -> Result<(), USIAgentRunningError<'_, SystemEventQueue, E>>

ログファイルのパスを指定して開始

§Arguments
  • path - ログファイルのパス
  • on_error - エラー発生時に呼ばれるコールバック関数。エラーオブジェクトへの参照とロガーが渡される。
Source

pub fn start<R, W, L, F>( &self, reader: R, writer: W, logger: L, on_error: F, ) -> Result<(), USIAgentRunningError<'_, SystemEventQueue, E>>
where R: USIInputReader + Send + 'static, W: USIOutputWriter + Send + 'static, L: Logger + Debug + Send + 'static, F: FnMut(Option<Arc<Mutex<OnErrorHandler<L>>>>, &USIAgentRunningError<'_, SystemEventQueue, E>), EventHandlerError<SystemEventKind, E>: From<E>, OnAcceptMove: Send + 'static,

Logger,USIInputReader,USIOutputWriterを指定して開始

§Arguments
  • reader - 入力を読み取るためのオブジェクト。実装によって標準入力以外から読み取るものを指定することも可能。
  • writer - USIコマンドを出力するためのオブジェクト。実装によって標準出力以外へ書き込むものを指定することも可能。
  • logger - ログを書き込むためのオブジェクト。実装によってファイル以外に書き込むものを指定することも可能。
  • on_error - エラー発生時に呼ばれるコールバック関数。エラーオブジェクトへの参照とロガーが渡される。

Trait Implementations§

Source§

impl<T, E> Debug for UsiAgent<T, E>
where T: USIPlayer<E> + Debug + Send + 'static + Debug, E: PlayerError + Debug, EventHandlerError<SystemEventKind, E>: From<E>,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T, E> Freeze for UsiAgent<T, E>

§

impl<T, E> RefUnwindSafe for UsiAgent<T, E>

§

impl<T, E> !Send for UsiAgent<T, E>

§

impl<T, E> !Sync for UsiAgent<T, E>

§

impl<T, E> Unpin for UsiAgent<T, E>

§

impl<T, E> UnwindSafe for UsiAgent<T, E>

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V