pub trait Game: Diff {
type Options: Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static;
type OptionsPreset: Debug + Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static + Into<Self::Options>;
type PlayerOptions: PlayerOptions<Self> + Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static;
type Action: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static;
type Event: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static;
type PlayerView: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static;
type Results: Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static;
type DebugData: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static;
type DebugState: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static;
// Required methods
fn init(
rng: &mut dyn RngCore,
player_count: usize,
options: Self::Options,
) -> Self;
fn player_view(&self, player_index: usize) -> Self::PlayerView;
fn process_turn(
&mut self,
rng: &mut dyn RngCore,
actions: HashMap<usize, Self::Action>,
) -> Vec<Self::Event>;
fn finished(&self) -> bool;
fn results(&self) -> Self::Results;
}
Required Associated Types§
type Options: Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static
type OptionsPreset: Debug + Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static + Into<Self::Options>
type PlayerOptions: PlayerOptions<Self> + Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static
type Action: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static
type Event: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static
type PlayerView: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static
type Results: Serialize + for<'de> Deserialize<'de> + Sync + Send + Clone + 'static
type DebugData: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static
type DebugState: Serialize + for<'de> Deserialize<'de> + Trans + Sync + Send + Clone + 'static
Required Methods§
fn init( rng: &mut dyn RngCore, player_count: usize, options: Self::Options, ) -> Self
fn player_view(&self, player_index: usize) -> Self::PlayerView
fn process_turn( &mut self, rng: &mut dyn RngCore, actions: HashMap<usize, Self::Action>, ) -> Vec<Self::Event>
fn finished(&self) -> bool
fn results(&self) -> Self::Results
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.