From 8b5d0ef0ff67c3c9f1de238ca05147c0f2c0be55 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Wed, 28 Jul 2021 14:10:14 -0400 Subject: [PATCH] move confirmation description to function probably temporary --- src/confirmation.rs | 10 ++++++++-- src/lib.rs | 1 - src/main.rs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/confirmation.rs b/src/confirmation.rs index b5570a1..ddecc6a 100644 --- a/src/confirmation.rs +++ b/src/confirmation.rs @@ -1,5 +1,5 @@ /// A mobile confirmation. There are multiple things that can be confirmed, like trade offers. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy)] pub struct Confirmation { pub id: u64, pub key: u64, @@ -8,7 +8,13 @@ pub struct Confirmation { /// Trade offer ID or market transaction ID pub creator: u64, pub conf_type: ConfirmationType, - pub description: String, +} + +impl Confirmation { + /// Human readable representation of this confirmation. + pub fn description(&self) -> String { + format!("{:?} id={} key={}", self.conf_type, self.id, self.key) + } } #[derive(Debug, Clone, Copy)] diff --git a/src/lib.rs b/src/lib.rs index 68daf53..b5956e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -186,7 +186,6 @@ impl SteamGuardAccount { conf_type: conf_type, creator: conf_creator, int_type: 0, - description: "".into(), }]); } _ => { diff --git a/src/main.rs b/src/main.rs index 2ea030f..abb7efe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,7 +134,7 @@ fn main() { match account.get_trade_confirmations() { Ok(confs) => { for conf in confs { - println!("{:?}", conf); + println!("{}", conf.description()); } break; }