use std::rc::Rc;
pub use gpui::Platform;
pub fn background_executor() -> gpui::BackgroundExecutor {
current_platform(true).background_executor()
}
pub fn application() -> gpui::Application {
gpui::Application::with_platform(current_platform(false))
}
pub fn headless() -> gpui::Application {
gpui::Application::with_platform(current_platform(true))
}
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
pub fn current_platform(headless: bool) -> Rc<dyn Platform> {
gpui_linux::current_platform(headless)
}
#[cfg(target_os = "macos")]
pub fn current_platform(headless: bool) -> Rc<dyn Platform> {
gpui_macos::current_platform(headless)
}
#[cfg(target_os = "windows")]
pub fn current_platform(headless: bool) -> Rc<dyn Platform> {
gpui_windows::current_platform(headless)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn construction_entry_points_have_stable_types() {
let _: fn() -> gpui::Application = application;
let _: fn() -> gpui::Application = headless;
let _: fn() -> gpui::BackgroundExecutor = background_executor;
let _: fn(bool) -> Rc<dyn Platform> = current_platform;
}
}