idempotent_percent_encode

Function idempotent_percent_encode 

Source
pub fn idempotent_percent_encode(
    input: &str,
    encode_set: &'static AsciiSet,
) -> String
Expand description

Idempotently percent-encodes a string.

This function first checks if the input is already a correctly percent-encoded string according to the provided encode_set.

  • If it is, the input is returned
  • If it is not (i.e., it’s unencoded, partially encoded, or incorrectly encoded), the function encodes the entire input string and returns a new String