1use std::convert::Infallible;
2use std::fmt::{Debug, Display};
3use winit::error::EventLoopError;
4
5pub enum Error<E = Infallible> {
6 EventLoop(EventLoopError),
7 App(E),
8}
9
10impl<E: Debug> Debug for Error<E> {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 match self {
13 Self::EventLoop(err) => Debug::fmt(err, f),
14 Self::App(err) => Debug::fmt(err, f),
15 }
16 }
17}
18
19impl<E: Display> Display for Error<E> {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 match self {
22 Self::EventLoop(err) => Display::fmt(err, f),
23 Self::App(err) => Display::fmt(err, f),
24 }
25 }
26}