Expand description
day-part-deviceinfo — a HEADLESS cross-platform device-identity API. No UI; any Rust code can
depend on this crate and call get for a snapshot of the device model, OS name/version, and
whether it is running on a simulator/emulator, through each platform’s NATIVE API.
let d = day_part_deviceinfo::get();
println!("{} — {} {}{}", d.model, d.system_name, d.system_version,
if d.is_simulator { " (simulator)" } else { "" });Platform selection is purely #[cfg(target_os)]/#[cfg(target_env)] (device identity is an OS
concern, not a widget-toolkit one): macOS uses ProcessInfo + sysctl, iOS UIDevice, Windows
RtlGetVersion, Linux /etc/os-release + DMI, HarmonyOS the native libdeviceinfo_ndk.so, and
Android android.os.Build (via a Java shim staged by day build).
get never panics and never returns an error: fields that a platform cannot report are
filled with a sensible fallback ("Unknown", or system_name set to the OS family name).
Structs§
- Device
Info - A snapshot of the device’s identity. Every field is best-effort — each OS reports a different
slice of the truth, and unknown fields fall back to
"Unknown"(see the per-platform notes in docs/deviceinfo.md).
Functions§
- get
- Read the current device-identity snapshot via the platform’s native API. Never panics; unknown
fields fall back to
"Unknown"(or the OS family name forsystem_name).