aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-04-28 03:15:17 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-04-28 11:43:49 +0200
commit4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e (patch)
tree423b936e8f3329535cae6fc8974b790ff7424d94 /src/lib.rs
parent405cd1a7af60478a7ff3a688de044a5e578f54a4 (diff)
downloadevtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.tar.gz
evtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.tar.bz2
evtclib-4c9adbcbbcea6d47c009d464c6f9d30a15b7fb1e.zip
getters for Player/Character/Gadget
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e2e22fb..f438460 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {