diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2020-10-12 14:49:14 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2020-10-12 14:49:14 -0700 |
commit | 463c8fb08fd5270a2f078affde992015cbb12165 (patch) | |
tree | d3fb1a9ed1154a7af962aee54e9ae2cc8e074fbd | |
parent | 1cf1579ebbf20590a8297c62cbf95ffaf095a9ca (diff) |
Make Uri::decode_element more flexible in what it takes as an argument
-rw-r--r-- | src/lib.rs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -590,15 +590,17 @@ impl Uri { } } - // TODO: look into making element type more flexible - fn decode_element( - element: &str, + fn decode_element<T>( + element: T, allowed_characters: &'static HashSet<char>, context: Context - ) -> Result<Vec<u8>, Error> { + ) -> Result<Vec<u8>, Error> + where T: AsRef<str> + { let mut decoding_pec = false; let mut pec_decoder = PercentEncodedCharacterDecoder::new(); element + .as_ref() .chars() .filter_map(|c| { if decoding_pec { |