diff options
author | Irene Knapp <ireneista@irenes.space> | 2024-03-12 22:06:24 -0700 |
---|---|---|
committer | Irene Knapp <ireneista@irenes.space> | 2024-03-12 22:06:24 -0700 |
commit | f25a79763b9ae493598230a109eb0788def17199 (patch) | |
tree | dfcee3742e7086985c7392944b0b98308c89b2c7 /src/terminal/error.rs | |
parent | 7be9acd0bb08901c9fdfa45b694b7d3d5a594e70 (diff) |
Change-Id: I3478f222ee4b24d9d1796f0f58986186119bc2f7
Diffstat (limited to 'src/terminal/error.rs')
-rw-r--r-- | src/terminal/error.rs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/terminal/error.rs b/src/terminal/error.rs deleted file mode 100644 index 795f973..0000000 --- a/src/terminal/error.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![forbid(unsafe_code)] - -pub type Result<T> = std::result::Result<T, TerminalError>; - - -#[derive(Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)] -pub enum TerminalError { - Input(String), - ModeSetting(String), - Internal(String), -} - -impl std::error::Error for TerminalError { } - -impl std::fmt::Display for TerminalError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - TerminalError::Input(s) => - f.write_fmt(format_args!( - "Can't read terminal input: {}", s)), - TerminalError::ModeSetting(s) => - f.write_fmt(format_args!( - "Can't set terminal mode: {}", s)), - TerminalError::Internal(s) => - f.write_fmt(format_args!( - "Internal error regarding the terminal: {}", s)), - } - } -} - - -pub fn input(e: impl std::error::Error) -> TerminalError { - TerminalError::ModeSetting(format!("{}", e)) -} - - -pub fn mode_setting(e: impl std::error::Error) -> TerminalError { - TerminalError::ModeSetting(format!("{}", e)) -} - - -pub fn internal(e: impl std::error::Error) -> TerminalError { - TerminalError::Internal(format!("{}", e)) -} - |