refactor: converge naming from main branch

This commit is contained in:
electria 2026-08-18 14:15:18 -07:00
commit 3fa2163366
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs
2 changed files with 11 additions and 11 deletions

View file

@ -7,21 +7,21 @@ use crate::app;
const CYAN: Color = Color::from_rgb8(0, 255, 255); const CYAN: Color = Color::from_rgb8(0, 255, 255);
#[derive(Default)] #[derive(Default)]
pub struct CpuGraph { pub struct Graph {
pub cache: canvas::Cache, pub cache: canvas::Cache,
timeline: VecDeque<f32>, timeline: VecDeque<f32>,
} }
impl CpuGraph { impl Graph {
pub fn update(&mut self, usage: f32) { pub fn update(&mut self, value: f32) {
self.timeline.push_back(usage); self.timeline.push_back(value);
if self.timeline.len() > 1000 { if self.timeline.len() > 1000 {
self.timeline.pop_front(); self.timeline.pop_front();
} }
} }
} }
impl canvas::Program<app::Message, Theme, Renderer> for CpuGraph { impl canvas::Program<app::Message, Theme, Renderer> for Graph {
type State = (); type State = ();
fn draw( fn draw(
&self, &self,

View file

@ -1,19 +1,19 @@
use iced::{ use iced::{
Color, Element, Length, Renderer, Task, Theme, application, futures::SinkExt, stream::channel, Color, Element, Length, Renderer, Task, Theme, application, futures::SinkExt, stream, theme,
theme, widget, widget,
}; };
use smol::Timer; use smol::Timer;
use crate::app::cpu_graph::CpuGraph; use crate::app::graph::Graph;
mod cpu_graph; mod graph;
enum Message { enum Message {
Cpu(f32), Cpu(f32),
} }
struct State { struct State {
cpu_graph: CpuGraph, cpu_graph: Graph,
} }
impl State { impl State {
@ -23,7 +23,7 @@ impl State {
cpu_graph: Default::default(), cpu_graph: Default::default(),
}, },
Task::run( Task::run(
channel(1, async |mut sender| { stream::channel(1, async |mut sender| {
let mut sys = sysinfo::System::new(); let mut sys = sysinfo::System::new();
let refreshes = sysinfo::RefreshKind::nothing() let refreshes = sysinfo::RefreshKind::nothing()
.with_cpu(sysinfo::CpuRefreshKind::nothing().with_cpu_usage()); .with_cpu(sysinfo::CpuRefreshKind::nothing().with_cpu_usage());