fixed returns
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user