fixed returns

This commit is contained in:
2025-08-09 12:47:50 +02:00
parent 2e4d17f964
commit 2b9e1eccb5
3 changed files with 8 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
use std::error::Error;
use anyhow::Result;
use sysinfo::System;
@@ -19,7 +21,7 @@ pub async fn get_memory_info() -> Result<MemoryInfo> {
})
}
pub fn _get_memory_usage(sys: &mut System) -> f64 {
pub fn _get_memory_usage(sys: &mut System) -> Result<f64, Box<dyn Error>> {
sys.refresh_memory();
(sys.used_memory() as f64 / sys.total_memory() as f64) * 100.0
Ok((sys.used_memory() as f64 / sys.total_memory() as f64) * 100.0)
}