move confirmation description to function

probably temporary
This commit is contained in:
Carson McManus 2021-07-28 14:10:14 -04:00
parent c23db2a5e9
commit 8b5d0ef0ff
3 changed files with 9 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/// A mobile confirmation. There are multiple things that can be confirmed, like trade offers. /// 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 struct Confirmation {
pub id: u64, pub id: u64,
pub key: u64, pub key: u64,
@ -8,7 +8,13 @@ pub struct Confirmation {
/// Trade offer ID or market transaction ID /// Trade offer ID or market transaction ID
pub creator: u64, pub creator: u64,
pub conf_type: ConfirmationType, 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)] #[derive(Debug, Clone, Copy)]

View file

@ -186,7 +186,6 @@ impl SteamGuardAccount {
conf_type: conf_type, conf_type: conf_type,
creator: conf_creator, creator: conf_creator,
int_type: 0, int_type: 0,
description: "".into(),
}]); }]);
} }
_ => { _ => {

View file

@ -134,7 +134,7 @@ fn main() {
match account.get_trade_confirmations() { match account.get_trade_confirmations() {
Ok(confs) => { Ok(confs) => {
for conf in confs { for conf in confs {
println!("{:?}", conf); println!("{}", conf.description());
} }
break; break;
} }