aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-04-27 15:40:59 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-04-27 15:40:59 +0200
commitf750818b80ce60a6f9f587cd9ee393d60829c0ac (patch)
treeaef01b8ee43e1f6c1dbce6f51604caf1bc9ed483
parent1baebacc7f8541ed7077b12b3f8989255ec290fe (diff)
downloadevtclib-f750818b80ce60a6f9f587cd9ee393d60829c0ac.tar.gz
evtclib-f750818b80ce60a6f9f587cd9ee393d60829c0ac.tar.bz2
evtclib-f750818b80ce60a6f9f587cd9ee393d60829c0ac.zip
change some getters to copy
The types are so small that a reference would be slower than just copying the number itself.
-rw-r--r--src/lib.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 891e387..85e3a2d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,7 +18,7 @@
//! module](raw/parser/index.html#buffering))
use thiserror::Error;
-use getset::Getters;
+use getset::{CopyGetters, Getters};
pub mod raw;
@@ -91,29 +91,29 @@ impl fmt::Display for AgentName {
}
/// An agent.
-#[derive(Debug, Clone, Getters)]
+#[derive(Debug, Clone, Getters, CopyGetters)]
pub struct Agent {
- #[get = "pub"]
+ #[get_copy = "pub"]
addr: u64,
#[get = "pub"]
kind: AgentKind,
- #[get = "pub"]
+ #[get_copy = "pub"]
toughness: i16,
- #[get = "pub"]
+ #[get_copy = "pub"]
concentration: i16,
- #[get = "pub"]
+ #[get_copy = "pub"]
healing: i16,
- #[get = "pub"]
+ #[get_copy = "pub"]
condition: i16,
#[get = "pub"]
name: AgentName,
- #[get = "pub"]
+ #[get_copy = "pub"]
instance_id: u16,
- #[get = "pub"]
+ #[get_copy = "pub"]
first_aware: u64,
- #[get = "pub"]
+ #[get_copy = "pub"]
last_aware: u64,
- #[get = "pub"]
+ #[get_copy = "pub"]
master_agent: Option<u64>,
}
@@ -253,7 +253,7 @@ impl Log {
/// Check whether the given address is a boss agent.
pub fn is_boss(&self, addr: u64) -> bool {
- self.boss_agents().into_iter().any(|a| *a.addr() == addr)
+ self.boss_agents().into_iter().any(|a| a.addr() == addr)
}
/// Returns the boss/encounter id.