change serialize_map to serialize_struct
This commit is contained in:
@@ -719,8 +719,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use serde::ser::SerializeMap;
|
use serde::ser::SerializeStruct;
|
||||||
let mut map = serializer.serialize_map(Some(2))?;
|
let mut map = serializer.serialize_struct("Session", 3)?;
|
||||||
// serialize the initial state of the game.
|
// serialize the initial state of the game.
|
||||||
// if there is history, it is the first snapshot's state,
|
// if there is history, it is the first snapshot's state,
|
||||||
// otherwise it is the current game state since there are no moves.
|
// otherwise it is the current game state since there are no moves.
|
||||||
@@ -729,9 +729,9 @@ where
|
|||||||
} else {
|
} else {
|
||||||
&self.state.state
|
&self.state.state
|
||||||
};
|
};
|
||||||
map.serialize_entry("config", &self.config)?;
|
map.serialize_field("config", &self.config)?;
|
||||||
map.serialize_entry("state", state)?;
|
map.serialize_field("state", state)?;
|
||||||
map.serialize_entry("history", &History(&self.state.history))?;
|
map.serialize_field("history", &History(&self.state.history))?;
|
||||||
map.end()
|
map.end()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user