nifty_platform/lib.rs
1//! Picks the native backend for the operating system Nifty is built for.
2
3#[cfg(not(any(target_os = "macos", windows)))]
4compile_error!("Nifty has macOS and Windows backends so far; the Linux backend is next");
5
6#[cfg(target_os = "macos")]
7pub type PlatformBackend = nifty_macos::MacBackend;
8
9#[cfg(windows)]
10pub type PlatformBackend = nifty_windows::WinBackend;
11
12/// # Panics
13/// On macOS, when called off the main thread, which `AppKit` forbids; on Windows, when the
14/// system can't register Nifty's window classes.
15#[must_use]
16pub fn platform_backend() -> PlatformBackend {
17 PlatformBackend::new()
18}