diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2020-10-13 01:09:18 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2020-10-13 01:09:18 -0700 |
commit | dc2a011598f4aa9e9de927333e467e623276d5ec (patch) | |
tree | 4b5c71634af516cdc96c512f28a02370d48c25b3 /src/percent_encoded_character_decoder.rs | |
parent | 4accf8c296ef7a1f6bd10a90b7a06b3b499ccda6 (diff) |
Rust refactoring
* Move Context, Error, and character classes to their own modules.
* Move host/port parsing and IP address validation to their
own modules, and break the code up into different functions
to process their state machines.
Diffstat (limited to 'src/percent_encoded_character_decoder.rs')
-rw-r--r-- | src/percent_encoded_character_decoder.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/percent_encoded_character_decoder.rs b/src/percent_encoded_character_decoder.rs index b07be50..8a11c8d 100644 --- a/src/percent_encoded_character_decoder.rs +++ b/src/percent_encoded_character_decoder.rs @@ -2,11 +2,7 @@ use std::convert::TryFrom; -#[derive(Debug, Clone, thiserror::Error, PartialEq)] -pub enum Error { - #[error("illegal character")] - IllegalCharacter, -} +use super::error::Error; pub struct PercentEncodedCharacterDecoder { decoded_character: u8, @@ -50,7 +46,7 @@ impl PercentEncodedCharacterDecoder { self.decoded_character += u8::try_from(ci).unwrap(); } else { self.reset(); - return Err(Error::IllegalCharacter); + return Err(Error::IllegalPercentEncoding); } Ok(()) } |