aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2020-10-12 14:49:14 -0700
committerRichard Walters <rwalters@digitalstirling.com>2020-10-12 14:49:14 -0700
commit463c8fb08fd5270a2f078affde992015cbb12165 (patch)
treed3fb1a9ed1154a7af962aee54e9ae2cc8e074fbd /src/lib.rs
parent1cf1579ebbf20590a8297c62cbf95ffaf095a9ca (diff)
Make Uri::decode_element more flexible in what it takes as an argument
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs10
1 files 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<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 {