macro_rules! urlencoding_str { (E: $data:expr) => { ... }; (D: $data:expr) => { ... }; }
See Encode or Decode for more information.
Encode
Decode
let data = urlencoding_str!(E: "你好, 世界").to_string_ext(); assert_eq!(data, "%E4%BD%A0%E5%A5%BD%2C%20%E4%B8%96%E7%95%8C"); let data = urlencoding_str!(D: "%E4%BD%A0%E5%A5%BD%2C%20%E4%B8%96%E7%95%8C").to_string_ext(); assert_eq!(data, "你好, 世界");