use core::fmt;
use std::{
error::Error,
fmt::{Debug, Formatter},
};
pub enum Cause {
Suppose(String),
Panicked(String),
}
impl Debug for Cause {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::Suppose(r) => f.debug_tuple("Suppose").field(r).finish(),
Self::Panicked(p) => f.debug_tuple("Panicked").field(p).finish(),
}
}
}
#[cfg(feature = "compact")]
pub enum Compact<T> {
Suppose(T),
Panicked(String),
}
#[cfg(feature = "compact")]
impl<T: Debug> Debug for Compact<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::Suppose(r) => f.debug_tuple("Suppose").field(r).finish(),
Self::Panicked(p) => f.debug_tuple("Panicked").field(p).finish(),
}
}
}
pub type IOError = Box<dyn Error>;
pub type RtError = IOError;