use core::error::Error;
use core::fmt::{Debug, Display, Formatter};
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct UnknownVariant<T>(pub T);
impl<T: Copy> UnknownVariant<T> {
pub const fn new(value: T) -> Self {
Self(value)
}
pub const fn value(&self) -> T {
self.0
}
}
impl<T: Copy + Display> Display for UnknownVariant<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), core::fmt::Error> {
write!(f, "Unknown enum variant: {}", self.0)
}
}
impl<T: Copy + Debug + Display> Error for UnknownVariant<T> {}