use sys::{Component, Disk, DiskType, Process, Processor};
use libc::pid_t;
use std::collections::HashMap;
pub trait DiskExt {
fn get_type(&self) -> DiskType;
fn get_name(&self) -> &str;
fn get_file_system(&self) -> &str;
fn get_mount_point(&self) -> &str;
fn get_total_space(&self) -> u64;
fn get_available_space(&self) -> u64;
fn update(&mut self) -> bool;
}
pub trait ProcessExt {
fn new(pid: pid_t, parent: Option<pid_t>, start_time: u64) -> Self;
fn kill(&self, signal: ::Signal) -> bool;
}
pub trait ProcessorExt {
fn get_cpu_usage(&self) -> f32;
fn get_name(&self) -> &str;
}
pub trait SystemExt {
fn new() -> Self;
fn refresh_system(&mut self);
fn refresh_processes(&mut self);
fn refresh_disks(&mut self);
fn refresh_disk_list(&mut self);
fn refresh_all(&mut self) {
self.refresh_system();
self.refresh_processes();
self.refresh_disks();
}
fn get_process_list(&self) -> &HashMap<pid_t, Process>;
fn get_process(&self, pid: pid_t) -> Option<&Process>;
fn get_process_by_name(&self, name: &str) -> Vec<&Process>;
fn get_processor_list(&self) -> &[Processor];
fn get_total_memory(&self) -> u64;
fn get_free_memory(&self) -> u64;
fn get_used_memory(&self) -> u64;
fn get_total_swap(&self) -> u64;
fn get_free_swap(&self) -> u64;
fn get_used_swap(&self) -> u64;
fn get_components_list(&self) -> &[Component];
fn get_disks(&self) -> &[Disk];
}