1#![cfg_attr(docsrs, feature(doc_cfg))]
4#![cfg(not(any(windows, target_os = "macos")))]
5
6use winio_callback::Runnable;
7
8pub(crate) struct GlobalRuntime;
9
10impl Runnable for GlobalRuntime {
11 #[inline]
12 fn run() {
13 RUNTIME.with(|runtime| runtime.run())
14 }
15}
16
17scoped_tls::scoped_thread_local!(pub(crate) static RUNTIME: Runtime);
18
19mod runtime;
20pub use runtime::*;
21
22mod ui;
23pub use ui::*;
24
25#[derive(Debug, thiserror::Error)]
26#[non_exhaustive]
27pub enum Error {
28 #[error("IO error: {0}")]
30 Io(#[from] std::io::Error),
31 #[error("Bool error: {0}")]
33 Bool(#[from] gtk4::glib::BoolError),
34 #[error("Glib error: {0}")]
36 Glib(#[from] gtk4::glib::Error),
37 #[error("Cairo error: {0}")]
39 Cairo(#[from] gtk4::cairo::Error),
40 #[error("Index error: {0}")]
42 Index(usize),
43 #[error("Null pointer returned")]
45 NullPointer,
46 #[error("Cast failed")]
48 CastFailed,
49 #[error("Color theme is not available")]
51 NoColorTheme,
52 #[error("Feature not supported")]
54 NotSupported,
55}
56
57pub type Result<T, E = Error> = std::result::Result<T, E>;