Measurement units

heim heavily relies on the uom crate in order to expose proper measurement units where it is applicable.

In a short, that means that, for example, heim::cpu::CpuFrequency struct methods are returning Frequency type, instead of the primitive types such as u64, which are prone to the logical bugs.

heim re-exports all used measurement quantities and units at heim::units module.
Refer to uom documentation on how to work with these types.

Example

use heim::{cpu, units, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let freq = cpu::frequency().await?;

    println!("Current CPU frequency: {} GHz", freq.current().get::<units::frequency::gigahertz>());

    Ok(())
}