From 9bb60ea5f6513e6e2c5fe48c40d757eb3eca3801 Mon Sep 17 00:00:00 2001 From: nyyu Date: Mon, 1 Nov 2021 08:35:19 +0100 Subject: [PATCH] use f32 --- src/cgg_data_source.rs | 8 ++++---- src/data_source.rs | 4 ++-- src/ms_data_source.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cgg_data_source.rs b/src/cgg_data_source.rs index ce4f664..fbda60d 100644 --- a/src/cgg_data_source.rs +++ b/src/cgg_data_source.rs @@ -48,7 +48,7 @@ struct Stats { #[derive(Deserialize)] struct Build { build: Vec, - win_rate: f64, + win_rate: f32, games: u32, } @@ -171,10 +171,10 @@ impl DataSource for CGGDataSource { position.to_owned(), blocks, Stat { - win_rate: (champ.stats.wins as f64 / champ.stats.games as f64) * 100f64, + win_rate: (champ.stats.wins as f32 / champ.stats.games as f32) * 100f32, games: champ.stats.games, - kda: (champ.stats.kills + champ.stats.assists) as f64 - / champ.stats.deaths as f64, + kda: (champ.stats.kills + champ.stats.assists) as f32 + / champ.stats.deaths as f32, patch: champ.patch.to_owned(), }, )); diff --git a/src/data_source.rs b/src/data_source.rs index 50bc829..7084132 100644 --- a/src/data_source.rs +++ b/src/data_source.rs @@ -33,9 +33,9 @@ pub struct Item { } pub struct Stat { - pub win_rate: f64, + pub win_rate: f32, pub games: u32, - pub kda: f64, + pub kda: f32, pub patch: String, } diff --git a/src/ms_data_source.rs b/src/ms_data_source.rs index 691b2ed..535c524 100644 --- a/src/ms_data_source.rs +++ b/src/ms_data_source.rs @@ -82,10 +82,10 @@ impl DataSource for MSDataSource { let patch = &page[pos + 6..pos + 11]; pos = page.find("Win Rate:").unwrap(); - let win_rate: f64 = (&page[pos + 26..pos + 31]).parse().unwrap(); + let win_rate: f32 = (&page[pos + 26..pos + 31]).parse().unwrap(); pos = page.find("KDA:").unwrap(); - let kda: f64 = (&page[pos + 21..pos + 25]).parse().unwrap(); + let kda: f32 = (&page[pos + 21..pos + 25]).parse().unwrap(); let mut items = vec![];