#[cfg(feature = "sys")]
use crate::IoError;
#[doc = crate::TAG_RESULT!()]
pub type UiResult<T> = core::result::Result<T, UiError>;
#[non_exhaustive]
#[derive(Debug)]
pub enum UiError {
NotImplemented,
NotSupported,
#[cfg(feature = "sys")]
Io(IoError),
}
#[allow(dead_code)]
impl UiError {
pub(crate) const fn ni<T>() -> UiResult<T> {
Err(UiError::NotImplemented)
}
pub(crate) const fn ns<T>() -> UiResult<T> {
Err(UiError::NotSupported)
}
}
impl crate::Error for UiError {}
mod core_impls {
use super::*;
use crate::impl_trait;
impl_trait! { fmt::Display for UiError |self, f| {
use UiError as E;
match self {
E::NotImplemented => write!(f, "Not implemented."),
E::NotSupported => write!(f, "Not supported."),
#[cfg(feature = "sys")]
E::Io(e) => write!(f, "{e:?}"),
}
}}
#[cfg(feature = "sys")]
impl From<IoError> for UiError {
fn from(err: IoError) -> Self {
UiError::Io(err)
}
}
}