Function rpm_pkg_count::count

source ·
pub unsafe fn count() -> Option<u32>
Expand description

Return the count of installed RPM packages as a u32.

Code is manually translated from C as used by fastfetch: https://github.com/LinusDierheimer/fastfetch/blob/e837e1e1d1e5a7eba02235748cd1a20a72bc28f9/src/detection/packages/packages_linux.c#L230-L264

Examples found in repository?
examples/simple.rs (line 2)
1
2
3
4
5
6
fn main() {
    match unsafe { rpm_pkg_count::count() } {
        Some(count) => println!("{count} packages installed."),
        None => println!("packages could not be counted"),
    }
}