From 12c1426dc10cc30c58e2c8970d73ca8a98e087fa Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 14 Jun 2018 16:09:07 +0200 Subject: derive getters for Agent --- Cargo.toml | 3 ++- src/lib.rs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b2f02c8..7bc61e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,5 @@ num-traits = "0.2" num-derive = "0.2" quick-error = "1.2.1" byteorder = "1" -fnv = "1.0.3" \ No newline at end of file +fnv = "1.0.3" +getset = "0.0.6" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 5b3d661..5875abf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,8 @@ extern crate quick_error; #[macro_use] extern crate num_derive; +#[macro_use] +extern crate getset; extern crate byteorder; extern crate fnv; extern crate num_traits; @@ -88,18 +90,29 @@ pub enum AgentName { } /// An agent. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Getters)] pub struct Agent { + #[get="pub"] addr: u64, + #[get="pub"] kind: AgentKind, + #[get="pub"] toughness: i16, + #[get="pub"] concentration: i16, + #[get="pub"] healing: i16, + #[get="pub"] condition: i16, + #[get="pub"] name: AgentName, + #[get="pub"] instance_id: u16, + #[get="pub"] first_aware: u64, + #[get="pub"] last_aware: u64, + #[get="pub"] master_agent: Option, } -- cgit v1.2.3