diff --git a/src/client.rs b/src/client.rs index c27f248..8931516 100644 --- a/src/client.rs +++ b/src/client.rs @@ -269,7 +269,7 @@ where games: Option>, slots: Option>, tags: Vec, - data: serde_json::Value, + data: Option, ) -> Result<(), ArchipelagoError> { self.send(ClientMessage::Bounce(Bounce { games, @@ -423,7 +423,7 @@ impl ArchipelagoClientSender { games: Option>, slots: Option>, tags: Vec, - data: serde_json::Value, + data: Option, ) -> Result<(), ArchipelagoError> { self.send(ClientMessage::Bounce(Bounce { games, diff --git a/src/protocol/bounce.rs b/src/protocol/bounce.rs index c19eb14..5d1d465 100644 --- a/src/protocol/bounce.rs +++ b/src/protocol/bounce.rs @@ -21,7 +21,7 @@ struct InternalBounced { pub slots: Option>, #[serde(default)] pub tags: Vec, - pub data: Value, + pub data: Option, } // Deserialize Bounced based on its tags. @@ -36,9 +36,12 @@ impl<'de> Deserialize<'de> for Bounced { games: internal.games, slots: internal.slots, tags: internal.tags, - data: BounceData::DeathLink(match serde_json::from_value(internal.data) { - Ok(data) => data, - Err(err) => return Err(D::Error::custom(err)), + data: BounceData::DeathLink(match internal.data { + None => return Err(D::Error::custom("DeathLink Bounce should have data, but was None.")), + Some(data) => match serde_json::from_value(data) { + Ok(data) => data, + Err(err) => return Err(D::Error::custom(err)), + }, }), }) } else { @@ -55,7 +58,7 @@ impl<'de> Deserialize<'de> for Bounced { #[derive(Debug, Clone)] pub enum BounceData { DeathLink(DeathLink), - Generic(Value), + Generic(Option), } #[serde_as]