diff options
| author | zirkonya <zirkonya@iridium.lan> | 2026-08-10 02:33:11 +0200 |
|---|---|---|
| committer | zirkonya <zirkonya@iridium.lan> | 2026-08-10 02:33:11 +0200 |
| commit | 90042cc32f95286692755451aabdc928c315e2ce (patch) | |
| tree | 83996408080704fcf733c58df034a3754cba9595 /src/codec/error.rs | |
| parent | 98822553549d8772a55f5444ab3ead4b6a1e69d7 (diff) | |
Add context
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()) + } +} |
