MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / percent_encode_query_value

Function percent_encode_query_value

src/pglite/server.rs:521–534  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

519
520#[cfg(unix)]
521fn percent_encode_query_value(value: &str) -> String {
522 let mut encoded = String::with_capacity(value.len());
523 for byte in value.bytes() {
524 if matches!(
525 byte,
526 b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'~' | b'/'
527 ) {
528 encoded.push(byte as char);
529 } else {
530 encoded.push_str(&format!("%{byte:02X}"));
531 }
532 }
533 encoded
534}
535
536#[cfg(all(test, unix))]
537mod tests {

Callers

nothing calls this directly

Calls 3

lenMethod · 0.80
bytesMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected