(s: &str)
| 15 | } |
| 16 | |
| 17 | fn url_decode(s: &str) -> String { |
| 18 | let mut out = Vec::new(); |
| 19 | let bytes = s.as_bytes(); |
| 20 | let mut i = 0; |
| 21 | while i < bytes.len() { |
| 22 | if bytes[i] == b'%' |
| 23 | && i + 2 < bytes.len() |
| 24 | && let Ok(byte) = u8::from_str_radix( |
| 25 | std::str::from_utf8(&bytes[i + 1..i + 3]).unwrap(), |
| 26 | 16, |
| 27 | ) |
| 28 | { |
| 29 | out.push(byte); |
| 30 | i += 3; |
| 31 | continue; |
| 32 | } |
| 33 | out.push(bytes[i]); |
| 34 | i += 1; |
| 35 | } |
| 36 | String::from_utf8_lossy(&out).to_string() |
| 37 | } |
| 38 | |
| 39 | fn main() { |
| 40 | println!("cargo:rerun-if-changed=build.rs"); |