refactor: rename ChartType to ChartVariant
This commit is contained in:
@@ -16,12 +16,12 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
enum ChartType {
|
enum ChartVariant {
|
||||||
Cpu,
|
Cpu,
|
||||||
Memory,
|
Memory,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChartType {
|
impl ChartVariant {
|
||||||
const fn name(self) -> &'static str {
|
const fn name(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Self::Cpu => "cpu",
|
Self::Cpu => "cpu",
|
||||||
@@ -75,7 +75,7 @@ impl ChartType {
|
|||||||
|
|
||||||
/// Create charts
|
/// Create charts
|
||||||
fn make_chart<'a, T: Stats + Display>(
|
fn make_chart<'a, T: Stats + Display>(
|
||||||
chart_type: ChartType,
|
chart_type: ChartVariant,
|
||||||
colors: AppColors,
|
colors: AppColors,
|
||||||
current: &'a T,
|
current: &'a T,
|
||||||
dataset: Vec<Dataset<'a>>,
|
dataset: Vec<Dataset<'a>>,
|
||||||
@@ -143,7 +143,7 @@ pub fn draw(area: Rect, colors: AppColors, f: &mut Frame, fd: &FrameData) {
|
|||||||
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
|
#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
|
||||||
let mem_stats = ByteStats::new(mem.0.last().map_or(0, |f| f.1 as u64));
|
let mem_stats = ByteStats::new(mem.0.last().map_or(0, |f| f.1 as u64));
|
||||||
let cpu_chart = make_chart(
|
let cpu_chart = make_chart(
|
||||||
ChartType::Cpu,
|
ChartVariant::Cpu,
|
||||||
colors,
|
colors,
|
||||||
&cpu_stats,
|
&cpu_stats,
|
||||||
cpu_dataset,
|
cpu_dataset,
|
||||||
@@ -151,7 +151,7 @@ pub fn draw(area: Rect, colors: AppColors, f: &mut Frame, fd: &FrameData) {
|
|||||||
cpu.2,
|
cpu.2,
|
||||||
);
|
);
|
||||||
let mem_chart = make_chart(
|
let mem_chart = make_chart(
|
||||||
ChartType::Memory,
|
ChartVariant::Memory,
|
||||||
colors,
|
colors,
|
||||||
&mem_stats,
|
&mem_stats,
|
||||||
mem_dataset,
|
mem_dataset,
|
||||||
|
|||||||
Reference in New Issue
Block a user