From 463c8fb08fd5270a2f078affde992015cbb12165 Mon Sep 17 00:00:00 2001 From: Richard Walters Date: Mon, 12 Oct 2020 14:49:14 -0700 Subject: Make Uri::decode_element more flexible in what it takes as an argument --- src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 45400c6..9672d33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -590,15 +590,17 @@ impl Uri { } } - // TODO: look into making element type more flexible - fn decode_element( - element: &str, + fn decode_element( + element: T, allowed_characters: &'static HashSet, context: Context - ) -> Result, Error> { + ) -> Result, Error> + where T: AsRef + { let mut decoding_pec = false; let mut pec_decoder = PercentEncodedCharacterDecoder::new(); element + .as_ref() .chars() .filter_map(|c| { if decoding_pec { -- cgit v1.2.3