Function url::percent_encoding::percent_encode
[−]
[src]
pub fn percent_encode<E: EncodeSet>(input: &[u8], encode_set: E) -> PercentEncode<E>
Percent-encode the given bytes with the given encode set.
The encode set define which bytes (in addition to non-ASCII and controls)
need to be percent-encoded.
The choice of this set depends on context.
For example, ?
needs to be encoded in an URL path but not in a query string.
The return value is an iterator of &str
slices (so it has a .collect::<String>()
method)
that also implements Display
and Into<Cow<str>>
.
The latter returns Cow::Borrowed
when none of the bytes in input
are in the given encode set.