[][src]Trait oasis_game_core::UserFlow

pub trait UserFlow<T: Default + Clone + Serialize + DeserializeOwned> {
    fn initial_state(&self, seed: Option<u128>) -> T;
fn make_move(
        &self,
        state: &mut UserState<T>,
        game_move: &Move
    ) -> Result<(), Box<dyn Error>>; fn list_moves(&self) -> Vec<&'static str> { ... }
fn end_turn_if(&self, _: &UserState<T>) -> bool { ... }
fn end_game_if(&self, _: &UserState<T>) -> Option<(Option<Score>, Value)> { ... }
fn on_turn_begin(
        &self,
        state: &mut UserState<T>
    ) -> Result<(), Box<dyn Error>> { ... }
fn on_turn_end(
        &self,
        state: &mut UserState<T>
    ) -> Result<(), Box<dyn Error>> { ... }
fn on_move(
        &self,
        state: &mut UserState<T>,
        _: &Move
    ) -> Result<(), Box<dyn Error>> { ... }
fn get_current_players(&self, _: &UserState<T>) -> Option<Vec<u16>> { ... }
fn allowed_moves(&self, _: &UserState<T>, _: u16) -> Option<Vec<&str>> { ... }
fn optimistic_update(&self, _: &UserState<T>, _: &Move) -> bool { ... }
fn player_filter(&self) -> Option<fn(_: &T, _: u16) -> T> { ... } }

Required methods

fn initial_state(&self, seed: Option<u128>) -> T

fn make_move(
    &self,
    state: &mut UserState<T>,
    game_move: &Move
) -> Result<(), Box<dyn Error>>

Loading content...

Provided methods

fn list_moves(&self) -> Vec<&'static str>

fn end_turn_if(&self, _: &UserState<T>) -> bool

fn end_game_if(&self, _: &UserState<T>) -> Option<(Option<Score>, Value)>

fn on_turn_begin(&self, state: &mut UserState<T>) -> Result<(), Box<dyn Error>>

fn on_turn_end(&self, state: &mut UserState<T>) -> Result<(), Box<dyn Error>>

fn on_move(
    &self,
    state: &mut UserState<T>,
    _: &Move
) -> Result<(), Box<dyn Error>>

fn get_current_players(&self, _: &UserState<T>) -> Option<Vec<u16>>

fn allowed_moves(&self, _: &UserState<T>, _: u16) -> Option<Vec<&str>>

fn optimistic_update(&self, _: &UserState<T>, _: &Move) -> bool

fn player_filter(&self) -> Option<fn(_: &T, _: u16) -> T>

Loading content...

Implementors

Loading content...