diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-02-17 17:42:51 -0500 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-02-17 17:42:51 -0500 |
commit | 4485d1b380e45b4c86cbb41ba1d5f1f3f3799721 (patch) | |
tree | f9b57d13768d2fe010bdf5b56563b79d7464ebea /src/data_conversion.rs | |
parent | c669b5337c5267120448b28b0cd9a48975e59dc9 (diff) |
Some clippy and refactoring.
Diffstat (limited to 'src/data_conversion.rs')
-rw-r--r-- | src/data_conversion.rs | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/src/data_conversion.rs b/src/data_conversion.rs index 71f921b1..26cbd9c1 100644 --- a/src/data_conversion.rs +++ b/src/data_conversion.rs @@ -35,27 +35,7 @@ pub struct ConvertedProcessData { #[derive(Clone, Default, Debug)] pub struct ConvertedCpuData { pub cpu_name: String, - pub cpu_data: Vec<CpuPoint>, -} - -#[derive(Clone, Default, Debug)] -pub struct CpuPoint { - pub time: f64, - pub usage: f64, -} - -impl From<CpuPoint> for (f64, f64) { - fn from(c: CpuPoint) -> (f64, f64) { - let CpuPoint { time, usage } = c; - (time, usage) - } -} - -impl From<&CpuPoint> for (f64, f64) { - fn from(c: &CpuPoint) -> (f64, f64) { - let CpuPoint { time, usage } = c; - (*time, *usage) - } + pub cpu_data: Vec<(f64, f64)>, } pub fn convert_temp_row(app: &App) -> Vec<Vec<String>> { @@ -150,16 +130,14 @@ pub fn convert_cpu_data_points( //Insert joiner points for &(joiner_offset, joiner_val) in &cpu.1 { let offset_time = time_from_start - joiner_offset as f64; - cpu_data_vector[itx_offset].cpu_data.push(CpuPoint { - time: offset_time, - usage: joiner_val, - }); + cpu_data_vector[itx_offset] + .cpu_data + .push((offset_time, joiner_val)); } - cpu_data_vector[itx_offset].cpu_data.push(CpuPoint { - time: time_from_start, - usage: cpu.0, - }); + cpu_data_vector[itx_offset] + .cpu_data + .push((time_from_start, cpu.0)); } } |