fix trait
This commit is contained in:
+2
-2
@@ -3,7 +3,7 @@ use crate::Rng;
|
|||||||
// TODO: pub struct ValidInstruction<I>(I);
|
// TODO: pub struct ValidInstruction<I>(I);
|
||||||
pub trait Game {
|
pub trait Game {
|
||||||
type Instruction;
|
type Instruction;
|
||||||
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction>;
|
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> + use<Self>;
|
||||||
fn validate_instruction(&self, instruction: Self::Instruction) -> bool;
|
fn validate_instruction(&self, instruction: Self::Instruction) -> bool;
|
||||||
fn process_instruction(&mut self, instruction: Self::Instruction);
|
fn process_instruction(&mut self, instruction: Self::Instruction);
|
||||||
fn is_win(&self) -> bool;
|
fn is_win(&self) -> bool;
|
||||||
@@ -189,7 +189,7 @@ where
|
|||||||
G::Instruction: Clone,
|
G::Instruction: Clone,
|
||||||
{
|
{
|
||||||
type Instruction = G::Instruction;
|
type Instruction = G::Instruction;
|
||||||
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> {
|
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> + use<G> {
|
||||||
self.state.possible_instructions()
|
self.state.possible_instructions()
|
||||||
}
|
}
|
||||||
fn validate_instruction(&self, instruction: Self::Instruction) -> bool {
|
fn validate_instruction(&self, instruction: Self::Instruction) -> bool {
|
||||||
|
|||||||
+1
-1
@@ -82,7 +82,7 @@ impl Klondike {
|
|||||||
}
|
}
|
||||||
impl Game for Klondike {
|
impl Game for Klondike {
|
||||||
type Instruction = KlondikeInstruction;
|
type Instruction = KlondikeInstruction;
|
||||||
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> {
|
fn possible_instructions(&self) -> impl Iterator<Item = Self::Instruction> + use<> {
|
||||||
vec![].into_iter()
|
vec![].into_iter()
|
||||||
}
|
}
|
||||||
fn validate_instruction(&self, instruction: Self::Instruction) -> bool {
|
fn validate_instruction(&self, instruction: Self::Instruction) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user