(input: &str)
| 968 | } |
| 969 | |
| 970 | fn form_url_encode(input: &str) -> String { |
| 971 | let mut encoded = String::with_capacity(input.len()); |
| 972 | for byte in input.bytes() { |
| 973 | match byte { |
| 974 | b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'*' => { |
| 975 | encoded.push(byte as char); |
| 976 | } |
| 977 | b' ' => encoded.push('+'), |
| 978 | _ => { |
| 979 | use std::fmt::Write as _; |
| 980 | let _ = write!(encoded, "%{byte:02X}"); |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 | encoded |
| 985 | } |
| 986 | |
| 987 | fn hex_value(byte: u8) -> Option<u8> { |
| 988 | match byte { |
no test coverage detected