abletk/src/platform.rs

31 lines
1.0 KiB
Rust
Executable File

#[cfg(target_os = "windows")] const TARGET_PLATFORM: Platform = Platform::Windows;
#[cfg(target_os = "linux")] const TARGET_PLATFORM: Platform = Platform::Linux;
#[cfg(target_os = "macos")] const TARGET_PLATFORM: Platform = Platform::MacOS;
#[cfg(not(any(
target_os = "windows",
target_os = "linux",
target_os = "macos",
)))]
const TARGET_PLATFORM: Platform = Platform::Unknown;
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
/// An enum of operating systems that are supported by AbleTK. This does not
/// correspond to backends used by AbleTK, and is to be used by applications
/// that have platform-dependent behaviour.
// Contributors: name these according to their marketing names, including
// capitalisation, only changing the first letter to an upper
// case letter. E.g. Windows not Win32, MacOS not MacOs or macOS.
pub enum Platform {
Windows,
Linux,
MacOS,
Unknown
}
impl Platform {
pub const fn target() -> Self {
TARGET_PLATFORM
}
}