#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum BatteryState {
Charging,
Discharging,
#[default]
Full,
NotCharging,
Unknown,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct BatteryInfo {
pub level: f32,
pub state: BatteryState,
pub is_low_power_mode: bool,
pub time_to_empty_secs: Option<u32>,
pub time_to_full_secs: Option<u32>,
}
impl Default for BatteryInfo {
fn default() -> Self {
Self {
level: 1.0,
state: BatteryState::Full,
is_low_power_mode: false,
time_to_empty_secs: None,
time_to_full_secs: None,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
pub enum ThermalState {
#[default]
Nominal,
Fair,
Serious,
Critical,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
pub enum MemoryPressure {
#[default]
Normal,
Warning,
Critical,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum GpuBackend {
Metal,
Vulkan,
Direct3D12,
WebGpu,
OpenGl,
#[default]
Software,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GpuInfo {
pub backend: GpuBackend,
pub device_name: String,
pub driver_version: String,
pub vram_total_bytes: u64,
pub vram_used_bytes: u64,
}
impl Default for GpuInfo {
fn default() -> Self {
Self {
backend: GpuBackend::Software,
device_name: "Strata Software Rasterizer".to_string(),
driver_version: "1.0.0".to_string(),
vram_total_bytes: 0,
vram_used_bytes: 0,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct DisplayRefreshInfo {
pub current_hz: f32,
pub max_hz: f32,
pub is_variable_refresh_rate: bool,
pub is_high_refresh_rate: bool,
}
impl Default for DisplayRefreshInfo {
fn default() -> Self {
Self {
current_hz: 60.0,
max_hz: 60.0,
is_variable_refresh_rate: false,
is_high_refresh_rate: false,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ConnectionType {
#[default]
Wifi,
Cellular,
Ethernet,
Bluetooth,
Unknown,
None,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CellularGen {
TwoG,
ThreeG,
FourG,
FiveG,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct NetworkStatus {
pub is_online: bool,
pub connection_type: ConnectionType,
pub cellular_generation: Option<CellularGen>,
pub downlink_mbps: Option<f32>,
pub rtt_ms: Option<u32>,
pub is_metered: bool,
}
impl Default for NetworkStatus {
fn default() -> Self {
Self {
is_online: true,
connection_type: ConnectionType::Wifi,
cellular_generation: None,
downlink_mbps: Some(100.0),
rtt_ms: Some(20),
is_metered: false,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct SafeAreaInsets {
pub top: f32,
pub right: f32,
pub bottom: f32,
pub left: f32,
}
impl SafeAreaInsets {
pub const fn zero() -> Self {
Self {
top: 0.0,
right: 0.0,
bottom: 0.0,
left: 0.0,
}
}
pub const fn all(val: f32) -> Self {
Self {
top: val,
right: val,
bottom: val,
left: val,
}
}
pub const fn symmetric(vertical: f32, horizontal: f32) -> Self {
Self {
top: vertical,
right: horizontal,
bottom: vertical,
left: horizontal,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum ColorGamut {
#[default]
Srgb,
DisplayP3,
Rec2020,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ScreenGeometry {
pub width_px: u32,
pub height_px: u32,
pub scale_factor: f32,
pub safe_area: SafeAreaInsets,
pub color_gamut: ColorGamut,
}
impl Default for ScreenGeometry {
fn default() -> Self {
Self {
width_px: 1280,
height_px: 800,
scale_factor: 1.0,
safe_area: SafeAreaInsets::zero(),
color_gamut: ColorGamut::Srgb,
}
}
}