1 2 3 4 5 6 7 8 9 10
use std::fs::read_to_string; use std::path::Path; const DMI_ID: &str = "/sys/devices/virtual/dmi/id"; pub(super) fn field(name: &str) -> Option<String> { read_to_string(Path::new(DMI_ID).join(name)) .ok() .map(|value| value.trim().to_owned()) }