egelm 0.1.1

A simple Elm-like framework for building GUI applications in Rust using egui.
Documentation
//! Errors returned by application and event-loop operations.

use egui_winit::winit;

/// An error that can prevent an [`crate::window::App`] from running.
///
/// These errors cover event-loop creation and execution, internal message
/// delivery, root error routing, and optional Ctrl-C handler installation.
///
/// # Examples
///
/// ```
/// use egelm::error::Error;
///
/// let error = Error::SendingOverChannel;
/// assert_eq!(error.to_string(), "could not send message over channel: channel disconnected");
/// ```
#[derive(thiserror::Error, Debug)]
pub enum Error {
	/// The platform event loop stopped with an error.
	#[error("event loop failed: {0}")]
	EventLoopFail(#[source] winit::error::EventLoopError),

	/// The platform event loop could not be built.
	#[error("could not build event loop: {0}")]
	EventLoopBuildFail(#[source] winit::error::EventLoopError),

	/// An internal channel was disconnected before a message could be sent.
	#[error("could not send message over channel: channel disconnected")]
	SendingOverChannel,

	/// A value of an unexpected type reached the root error channel.
	#[error("error of unexpected type reached root error channel: {0:?}")]
	UnknownErrorFromRoot(Box<dyn std::fmt::Debug + Sync + Send + 'static>),

	#[cfg(feature = "ctrlc")]
	/// The process Ctrl-C handler could not be installed.
	#[error("could not set ctrlc handler: {0}")]
	SetSigHandler(#[source] ctrlc::Error),
}