diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-09 15:31:13 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-09 15:31:13 +0200 |
commit | 545f79b03ca1fa778cfffb77ee0fbd0f5e66de44 (patch) | |
tree | a0324b8731f0042e89a6b0417837d8aa933e5aaf /server/protocol | |
parent | 1da3465d7a4402760aed03ce2f450cd1b412417f (diff) | |
download | hurrycurry-545f79b03ca1fa778cfffb77ee0fbd0f5e66de44.tar hurrycurry-545f79b03ca1fa778cfffb77ee0fbd0f5e66de44.tar.bz2 hurrycurry-545f79b03ca1fa778cfffb77ee0fbd0f5e66de44.tar.zst |
adjust logging and better duplex
Diffstat (limited to 'server/protocol')
-rw-r--r-- | server/protocol/src/lib.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs index 9c8d6bee..147a4fc3 100644 --- a/server/protocol/src/lib.rs +++ b/server/protocol/src/lib.rs @@ -17,7 +17,7 @@ */ use glam::{IVec2, Vec2}; use serde::{Deserialize, Serialize}; -use std::collections::HashSet; +use std::{collections::HashSet, fmt::Display}; pub use glam; @@ -170,3 +170,12 @@ pub enum ItemLocation { Tile(IVec2), Player(PlayerID), } + +impl Display for ItemLocation { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ItemLocation::Tile(pos) => write!(f, "tile({pos})"), + ItemLocation::Player(PlayerID(id)) => write!(f, "player({id})"), + } + } +} |