#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Platform {
Windows,
MacOs,
Linux,
Android,
Ios,
}
impl Platform {
pub const ALL: [Self; 5] = [
Self::Windows,
Self::MacOs,
Self::Linux,
Self::Android,
Self::Ios,
];
pub const DESKTOP: [Self; 3] = [Self::Windows, Self::MacOs, Self::Linux];
pub const MOBILE: [Self; 2] = [Self::Android, Self::Ios];
pub(crate) const fn is_mobile(self) -> bool {
matches!(self, Self::Android | Self::Ios)
}
pub(crate) const fn client_hint(self) -> &'static str {
match self {
Self::Windows => "\"Windows\"",
Self::MacOs => "\"macOS\"",
Self::Linux => "\"Linux\"",
Self::Android => "\"Android\"",
Self::Ios => "\"iOS\"",
}
}
}