mirror of
https://github.com/kunkunsh/kunkun-ext-neohtop.git
synced 2025-04-11 17:29:45 +00:00
fix mistmach return types
This commit is contained in:
parent
82eb4426f6
commit
250eb37fb6
@ -12,7 +12,6 @@ use sysinfo::{
|
|||||||
ProcessExt,
|
ProcessExt,
|
||||||
PidExt,
|
PidExt,
|
||||||
};
|
};
|
||||||
use std::slice::Iter;
|
|
||||||
use tauri::State;
|
use tauri::State;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@ -79,16 +78,17 @@ pub struct SystemStats {
|
|||||||
|
|
||||||
// Assume MacOS or Linux
|
// Assume MacOS or Linux
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn filter_disks(disks: &[Disk]) -> Iter<Disk> {
|
fn filter_disks(disks: &[Disk]) -> Vec<&sysinfo::Disk> {
|
||||||
disks.iter().filter(|disk| {
|
disks.iter().filter(|disk| {
|
||||||
// Filter for physical disks - typically those mounted at "/"
|
// Filter for physical disks - typically those mounted at "/"
|
||||||
disk.mount_point() == std::path::Path::new("/")
|
disk.mount_point() == std::path::Path::new("/")
|
||||||
})
|
})
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn filter_disks(disks: &[Disk]) -> Iter<Disk> {
|
fn filter_disks(disks: &[Disk]) -> Vec<&sysinfo::Disk> {
|
||||||
disks.iter()
|
disks.iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
@ -138,7 +138,8 @@ async fn get_processes(state: State<'_, AppState>) -> Result<(Vec<ProcessInfo>,
|
|||||||
*last_update = (current_time, current_rx, current_tx);
|
*last_update = (current_time, current_rx, current_tx);
|
||||||
|
|
||||||
// Calculate total disk usage
|
// Calculate total disk usage
|
||||||
let disk_stats = filter_disks(& sys.disks())
|
let disk_stats = filter_disks(&sys.disks())
|
||||||
|
.iter()
|
||||||
.fold((0, 0, 0), |acc, disk| {
|
.fold((0, 0, 0), |acc, disk| {
|
||||||
(
|
(
|
||||||
acc.0 + disk.total_space(),
|
acc.0 + disk.total_space(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user