pub fn decode<S: AsRef<str>>(input: S) -> Result<String, InvalidUriComponent>
Expand description
Decodes a URI component that may contain percent-encoded characters back into a plain string.
The function will look for %
signs and attempt to decode the following two characters as hex digits
representing a byte value. If the encoding is invalid, the function returns an error.
§Parameters
input
: The percent-encoded string to decode.
§Returns
A Result<String, InvalidUriComponent>
where:
Ok
contains the decoded string.Err
contains theInvalidUriComponent
error if the input is not a valid URI component.