From 65a77c28a50c9d1799593437e701a17704e3ea1f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 16 Apr 2022 11:12:25 +0100 Subject: [PATCH] dice: Change SpecialClientRendering representation Making this an internally-tageed union is going to be nicer for the JS, which then doesn't have to prat about with Object.keys(thing)[0] etc. And the special rendering is Die, not DieCooldown, since if dice get a second kind of special rendering thta will have to be here too. Signed-off-by: Ian Jackson --- src/dice.rs | 2 +- src/pcrender.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dice.rs b/src/dice.rs index 4dfb0f20..429bdc85 100644 --- a/src/dice.rs +++ b/src/dice.rs @@ -310,7 +310,7 @@ impl PieceBaseTrait for Die { #[throws(IE)] fn special(&self) -> Option { - Some(SpecialClientRendering::DieCooldown) + Some(SpecialClientRendering::Die{}) } } diff --git a/src/pcrender.rs b/src/pcrender.rs index bdffa164..f41aa71d 100644 --- a/src/pcrender.rs +++ b/src/pcrender.rs @@ -14,8 +14,9 @@ pub struct VisibleAngleTransform(Html); const DEFKEY_FLIP: UoKey = 'f'; #[derive(Serialize,Debug)] +#[serde(tag="kind")] pub enum SpecialClientRendering { - DieCooldown + Die { }, } #[derive(Debug,Clone)] -- 2.30.2