diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-07-07 03:41:40 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-07-07 03:41:40 +0200 |
commit | c1236e68f32511332c79d2195876eb51aaaa7c5e (patch) | |
tree | f59f1f038e35131dd1ebcb39d77932af15c16549 /src/lib.rs | |
parent | 32055313bd4ac5a9246ce92fd06156a370e14b17 (diff) | |
download | evtclib-c1236e68f32511332c79d2195876eb51aaaa7c5e.tar.gz evtclib-c1236e68f32511332c79d2195876eb51aaaa7c5e.tar.bz2 evtclib-c1236e68f32511332c79d2195876eb51aaaa7c5e.zip |
more readability
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -37,6 +37,8 @@ pub mod statistics; use statistics::gamedata::{self, Boss}; +use std::fmt; + /// A macro that returns `true` when the given expression matches the pattern. /// /// ```rust @@ -92,6 +94,18 @@ pub enum AgentName { }, } +impl fmt::Display for AgentName { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let name = match *self { + AgentName::Single(ref name) => name, + AgentName::Player { + ref character_name, .. + } => character_name, + }; + f.write_str(name) + } +} + /// An agent. #[derive(Debug, Clone, Getters)] pub struct Agent { |