mod error;
pub use error::{NativeError, Result};
pub mod modal;
pub mod terminate;
#[cfg(feature = "cli-tool")]
pub mod cli_tool;
#[cfg(feature = "clipboard")]
pub mod clipboard;
#[cfg(feature = "dialogs")]
pub mod dialogs;
#[cfg(feature = "display")]
pub mod display;
#[cfg(feature = "drag-out")]
pub mod drag_out;
#[cfg(feature = "hotkey")]
pub mod hotkey;
#[cfg(any(feature = "menu", feature = "hotkey"))]
#[allow(dead_code)]
mod key_code;
#[cfg(feature = "mac-shell")]
pub mod mac_shell;
#[cfg(feature = "memory")]
pub mod memory;
#[cfg(feature = "menu")]
pub mod menu;
#[cfg(all(not(target_arch = "wasm32"), any(feature = "tray", all(feature = "menu", any(target_os = "macos", target_os = "windows")))))]
mod menu_events;
#[cfg(any(feature = "tray", feature = "menu"))]
#[allow(dead_code)]
mod menu_tree;
#[cfg(feature = "notify")]
pub mod notify;
#[cfg(feature = "open-files")]
pub mod open_files;
#[cfg(feature = "power")]
pub mod power;
#[cfg(feature = "progress")]
pub mod progress;
#[cfg(feature = "secrets")]
pub mod secrets;
pub mod session_end;
#[cfg(feature = "single-instance")]
pub mod single_instance;
#[cfg(feature = "system")]
pub mod system;
#[cfg(feature = "tray")]
pub mod tray;
pub type Waker = std::sync::Arc<dyn Fn() + Send + Sync>;
pub fn no_waker() -> Waker {
std::sync::Arc::new(|| {})
}
#[allow(dead_code)]
pub(crate) fn guarded<T>(what: &str, f: impl FnOnce() -> Result<T>) -> Result<T> {
std::panic::catch_unwind(std::panic::AssertUnwindSafe(f)).unwrap_or_else(|_| Err(NativeError::Os(format!("{what} failed inside the OS binding"))))
}
#[allow(dead_code)]
pub(crate) fn os_text(e: impl std::fmt::Display) -> String {
let text: String = e.to_string().chars().map(|c| if c.is_control() { ' ' } else { c }).take(200).collect();
let text = text.trim();
if text.is_empty() { "no reason given".into() } else { text.to_string() }
}