diff options
Diffstat (limited to 'src/codec/error.rs')
| -rw-r--r-- | src/codec/error.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/codec/error.rs b/src/codec/error.rs index 6639c98..6037a9a 100644 --- a/src/codec/error.rs +++ b/src/codec/error.rs @@ -3,6 +3,7 @@ use std::fmt::Display; #[derive(Debug)] pub enum Error { IoError(std::io::Error), + Custom(String), } impl std::error::Error for Error {} @@ -20,3 +21,15 @@ impl From<std::io::Error> for Error { Self::IoError(value) } } + +impl From<String> for Error { + fn from(value: String) -> Self { + Self::Custom(value) + } +} + +impl From<&str> for Error { + fn from(value: &str) -> Self { + Self::Custom(value.to_string()) + } +} |
