Skip to content

Commit ba35a84

Browse files
committed
Add Debug impl to TerminalModeError
1 parent e445fec commit ba35a84

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mode/terminal.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl Cursor {
9696
}
9797

9898
/// Errors which can occur when interacting with the terminal mode
99+
#[derive(Clone)]
99100
pub enum TerminalModeError<DI>
100101
where
101102
DI: DisplayInterface,
@@ -108,6 +109,19 @@ where
108109
OutOfBounds,
109110
}
110111

112+
impl<DI> core::fmt::Debug for TerminalModeError<DI>
113+
where
114+
DI: DisplayInterface,
115+
{
116+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
117+
match self {
118+
InterfaceError(_) => "InterfaceError".fmt(f),
119+
Uninitialized => "Uninitialized".fmt(f),
120+
OutOfBounds => "OutOfBound".fmt(f),
121+
}
122+
}
123+
}
124+
111125
// Cannot use From<_> due to coherence
112126
trait IntoTerminalModeResult<DI, T>
113127
where

0 commit comments

Comments
 (0)