Skip to main content

encode

Function encode 

Source
pub fn encode(input: &str) -> Cow<'_, str>
Expand description

Percent-encodes a string per RFC 3986.

Returns the input borrowed when every byte is already in the unreserved set, otherwise an owned encoded copy.

ยงPanics

Never panics in practice: encode_bytes only emits ASCII bytes (unreserved characters or %HH pairs), so String::from_utf8 always succeeds.