rustftechh 0.1.1

A blazingly fast, highly extensible, and feature-rich system information tool written in Rust with fastfetch parity and multi-distro logos
1
2
3
4
5
6
7
8
9
10
use super::sysctl;
use crate::info::platform::format_usage_gib;

pub fn detect_swap() -> Option<String> {
    let usage: libc::xsw_usage = sysctl::sysctl_struct("vm.swapusage")?;
    if usage.xsu_total == 0 {
        return Some("Disabled".into());
    }
    format_usage_gib(usage.xsu_used, usage.xsu_total)
}