Function percent_encoding::percent_decode [−][src]
pub fn percent_decode(input: &[u8]) -> PercentDecode<'_>ⓘNotable traits for PercentDecode<'a>
impl<'a> Iterator for PercentDecode<'a> type Item = u8;
Percent-decode the given bytes.
https://url.spec.whatwg.org/#percent-decode
Any sequence of %
followed by two hexadecimal digits is decoded.
The return type:
- Implements
Into<Cow<u8>>
borrowinginput
when it contains no percent-encoded sequence, - Implements
Iterator<Item = u8>
and therefore has a.collect::<Vec<u8>>()
method, - Has
decode_utf8()
anddecode_utf8_lossy()
methods.
Examples
use percent_encoding::percent_decode; assert_eq!(percent_decode(b"foo%20bar%3f").decode_utf8().unwrap(), "foo bar?");