diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 03:15:17 +0200 | 
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 11:43:49 +0200 | 
| commit | 4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e (patch) | |
| tree | 423b936e8f3329535cae6fc8974b790ff7424d94 | |
| parent | 405cd1a7af60478a7ff3a688de044a5e578f54a4 (diff) | |
| download | evtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.tar.gz evtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.tar.bz2 evtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.zip | |
getters for Player/Character/Gadget
| -rw-r--r-- | src/lib.rs | 41 | 
1 files changed, 34 insertions, 7 deletions
| @@ -39,39 +39,66 @@ pub enum EvtcError {  }  /// Player-specific agent data. -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, CopyGetters)]  pub struct Player {      /// The player's profession. +    #[get_copy = "pub"]      profession: u32,      /// The player's elite specialization. +    #[get_copy = "pub"]      elite: u32, -    /// The player's character name.      character_name: String, -    /// The player's account name. -    /// -    /// This includes the leading colon and the 4-digit denominator.      account_name: String,      /// The subgroup the player was in. +    #[get_copy = "pub"]      subgroup: u8,  } +impl Player { +    /// The player's character name. +    pub fn character_name(&self) -> &str { +        &self.character_name +    } + +    /// The player's account name. +    /// +    /// This includes the leading colon and the 4-digit denominator. +    pub fn account_name(&self) -> &str { +        &self.account_name +    } +} +  /// Gadget-specific agent data. -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, CopyGetters)]  pub struct Gadget { +    #[get_copy = "pub"]      id: u16,      name: String,  } -#[derive(Debug, Clone, PartialEq, Eq)] +impl Gadget { +    pub fn name(&self) -> &str { +        &self.name +    } +} + +#[derive(Debug, Clone, PartialEq, Eq, CopyGetters)]  pub struct Character { +    #[get_copy = "pub"]      id: u16,      name: String,  } +impl Character { +    pub fn name(&self) -> &str { +        &self.name +    } +} +  /// The type of an agent.  #[derive(Debug, Clone, PartialEq, Eq)]  pub enum AgentKind { | 
