Trait IntoRunCondition

Source
pub trait IntoRunCondition {
    type RunCondition: RunCondition;

    // Required method
    fn into_run_condition(self) -> Self::RunCondition;
}
Expand description

Converts a type into a RunCondition used by Bot::select. It is recommended to mostly use Duration.

§Examples

use std::time::Duration;

let available_time = Duration::from_secs(2);

let game: Game = // ...
let mut bot: Bot = // ...
assert!(bot.select(&game, available_time).is_some())

§Implementations

  • Duration: select runs for the specified duration
  • ToCompletion: select runs until it found the perfect action
  • Depth: select analyses up the to given depth and returns to best action at that depth
  • Instant: select runs until the given Instant is in the past
  • Logger: takes another run condition and stores information about the last call to select

Required Associated Types§

Required Methods§

Source

fn into_run_condition(self) -> Self::RunCondition

consumes self and returns a RunCondition.

Implementations on Foreign Types§

Source§

impl IntoRunCondition for Duration

Creates a RunCondition which returns true until this Duration has passed.

Implementors§

Source§

impl IntoRunCondition for Steps

Source§

type RunCondition = InnerSteps

Source§

impl<'a, T: IntoRunCondition> IntoRunCondition for &'a mut Logger<T>

Source§

type RunCondition = InnerLogger<'a, T>

Source§

impl<T> IntoRunCondition for T
where T: RunCondition,