From 5b5d8d0785a76947816fef364adf63e6c5c98dce Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 27 Jun 2020 12:56:20 +0100 Subject: [PATCH] own PlayerId --- src/global.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/global.rs b/src/global.rs index c3bf3536..9cf260c1 100644 --- a/src/global.rs +++ b/src/global.rs @@ -5,10 +5,16 @@ use crate::imports::*; use lazy_static::lazy_static; slotmap::new_key_type!{ - pub struct PlayerId; pub struct ClientId; } +type SKD = slotmap::KeyData; +#[derive(Copy,Clone,PartialEq,Eq,Serialize,Deserialize,Debug)] +pub struct PlayerId (SKD); +impl slotmap::Key for PlayerId { } +impl From for PlayerId { fn from(d : SKD) -> Self { PlayerId(d) } } +impl From for SKD { fn from(p : PlayerId) -> Self { p.0 } } + #[derive(Clone,Debug,Eq,PartialEq,Ord,PartialOrd,Hash)] struct RawToken (String); impl Borrow for RawToken { -- 2.30.2