Description
Currently, percent_encode
and utf8_percent_encode
require the AsciiSet
to be 'static
, despite already having a lifetime bound 'a
on the input string.
This is very rarely an issue, but as part of a URL cleaning tool I'm making I allow users to choose various common AsciiSet
s from the URL spec and javascript. The API I've designed is an enum of names corresponding to those AsciiSet
s. For flexibility I'm considering adding a Custom(#[serde(some_glue_stuff)] AsciiSet)
to allow users with niche cases to not have to bodge stuff. This would require the getter function to go from get(&self) -> &'static AsciiSet
to get<'a>(&'a self) -> &'a AsciiSet
, which would make it incompatible with the percent_encode
and utf8_percent_encode
functions.
Fortunately the cases where this is needed are rare and perfectly fine for me to just upstream with a new name (which also avoids bloating the enum from 1 byte to 17 bytes), so it's not a big deal if the functions can't be changed to accept &'a AsciiSet
s. It's just not clear to me if or why they can't.