Minsweeper

Trait Minsweeper 

Source
pub trait Minsweeper {
    // Required methods
    fn start(&mut self) -> &GameState;
    fn gamestate(&self) -> &GameState;
    fn reveal(&mut self, point: Point) -> Result<&GameState, &GameState>;
    fn clear_around(&mut self, point: Point) -> Result<&GameState, &GameState>;
    fn set_flagged(
        &mut self,
        point: Point,
        flagged: bool,
    ) -> Result<&GameState, &GameState>;

    // Provided methods
    fn toggle_flag(&mut self, point: Point) -> Result<&GameState, &GameState> { ... }
    fn left_click(&mut self, point: Point) -> Result<&GameState, &GameState> { ... }
    fn right_click(&mut self, point: Point) -> Result<&GameState, &GameState> { ... }
}

Required Methods§

Source

fn start(&mut self) -> &GameState

Source

fn gamestate(&self) -> &GameState

Source

fn reveal(&mut self, point: Point) -> Result<&GameState, &GameState>

Source

fn clear_around(&mut self, point: Point) -> Result<&GameState, &GameState>

Source

fn set_flagged( &mut self, point: Point, flagged: bool, ) -> Result<&GameState, &GameState>

Provided Methods§

Source

fn toggle_flag(&mut self, point: Point) -> Result<&GameState, &GameState>

Source

fn left_click(&mut self, point: Point) -> Result<&GameState, &GameState>

Source

fn right_click(&mut self, point: Point) -> Result<&GameState, &GameState>

Implementors§

Source§

impl<T: InternalMinsweeper + ?Sized> Minsweeper for T