settings_model/
device_class.rs1use std::sync::atomic::{AtomicU8, Ordering};
10
11#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
12pub enum DeviceClass {
13 #[default]
14 Native,
15 Web,
16}
17
18static INSTALLED: AtomicU8 = AtomicU8::new(0);
19
20impl DeviceClass {
21 #[must_use]
22 pub fn current() -> Self {
23 match INSTALLED.load(Ordering::Acquire) {
24 1 => Self::Web,
25 _ => Self::Native,
26 }
27 }
28
29 pub fn install(self) {
30 let value = match self {
31 Self::Native => 0,
32 Self::Web => 1,
33 };
34 INSTALLED.store(value, Ordering::Release);
35 }
36}