[][src]Struct connect6::policy::IoPolicy

pub struct IoPolicy<'a, 'b> { /* fields omitted */ }

Policy for in-game user selection with io

Input format is {row lowercase}{col uppercase} such as "sS" or "aC". If invalid format or position is given, policy will write retrying message to stdout.

Note if given position raise Err from Game, game will be terminated by Agent.

Note We suggest that if you use IoPolicy, construct Agent with Agent::debug. IoPolicy doesn't displaying the board when you make the choice, so that if you want to confirm the board, you have to construct Agent in debug mode.

Examples

This example is not tested
io_policy_stdio!(io_policy);
Agent::debug(&mut io_policy).play().unwrap();

Methods

impl<'a, 'b> IoPolicy<'a, 'b>[src]

pub fn new(
    reader: &'a mut dyn Read,
    writer: &'b mut dyn Write
) -> IoPolicy<'a, 'b>
[src]

Construct a new IoPolicy

Examples

let mut stdin = std::io::stdin();
let mut stdout = std::io::stdout();
let mut io_policy = IoPolicy::new(&mut stdin, &mut stdout);

Trait Implementations

impl<'a, 'b> Policy for IoPolicy<'a, 'b>[src]

fn next(&mut self, _game: &Game) -> Option<(usize, usize)>[src]

validate user input from stdin and passing it to Agent

Auto Trait Implementations

impl<'a, 'b> !Send for IoPolicy<'a, 'b>

impl<'a, 'b> !Sync for IoPolicy<'a, 'b>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T