aboutsummaryrefslogtreecommitdiff
path: root/src/percent_encoded_character_decoder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/percent_encoded_character_decoder.rs')
-rw-r--r--src/percent_encoded_character_decoder.rs19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/percent_encoded_character_decoder.rs b/src/percent_encoded_character_decoder.rs
index 781a643..08a92e1 100644
--- a/src/percent_encoded_character_decoder.rs
+++ b/src/percent_encoded_character_decoder.rs
@@ -29,27 +29,12 @@ lazy_static! {
// TODO: Learn about using thiserror to define library errors
// [14:05] ABuffSeagull: You should use https://lib.rs/crates/thiserror for the errors
// [14:07] 715209: i also recommend thiserror
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone, thiserror::Error, PartialEq)]
pub enum Error {
+ #[error("illegal character")]
IllegalCharacter,
}
-impl std::fmt::Display for Error {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- match self {
- Error::IllegalCharacter => {
- write!(f, "illegal character")
- },
- }
- }
-}
-
-impl std::error::Error for Error {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- None
- }
-}
-
pub struct PercentEncodedCharacterDecoder {
decoded_character: u8,
digits_left: usize,