From 3020c21bca603f36384bf7cb7f1af4df70d0cd6b Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Mon, 8 Jun 2026 23:34:34 -0700 Subject: [PATCH] change serialize_map to serialize_struct --- card_game/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/card_game/src/lib.rs b/card_game/src/lib.rs index e35647e..a5e55c9 100644 --- a/card_game/src/lib.rs +++ b/card_game/src/lib.rs @@ -719,8 +719,8 @@ where } } - use serde::ser::SerializeMap; - let mut map = serializer.serialize_map(Some(2))?; + use serde::ser::SerializeStruct; + let mut map = serializer.serialize_struct("Session", 3)?; // serialize the initial state of the game. // if there is history, it is the first snapshot's state, // otherwise it is the current game state since there are no moves. @@ -729,9 +729,9 @@ where } else { &self.state.state }; - map.serialize_entry("config", &self.config)?; - map.serialize_entry("state", state)?; - map.serialize_entry("history", &History(&self.state.history))?; + map.serialize_field("config", &self.config)?; + map.serialize_field("state", state)?; + map.serialize_field("history", &History(&self.state.history))?; map.end() } }