diff options
Diffstat (limited to 'src/types.rs')
-rw-r--r-- | src/types.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/types.rs b/src/types.rs index 1c9ae89..84e7d46 100644 --- a/src/types.rs +++ b/src/types.rs @@ -62,13 +62,18 @@ impl Display for Player { } } -#[derive(Eq, PartialEq, Hash, Debug, Clone)] +#[derive(Eq, PartialEq, Hash, Debug, Clone, serde::Serialize)] pub struct RoomId(pub String); impl Display for RoomId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } } +impl std::borrow::Borrow<str> for RoomId { + fn borrow(&self) -> &str { + self.0.borrow() + } +} impl RoomId { pub fn new_in<T>(map: &HashMap<RoomId, T>) -> Self { |