querystring

A minimal Rust crate that parses and formats URL query strings with two focused functions.

Library
Cargo
v1.1.0
8stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
17/100Needs Attention
Development Activity0
Maintenance0
Community8
Maturity60
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
31/100Needs Attention
Architecture40
Code Quality30
Innovation15
Learning Curve40

querystring is a small, dependency-free Rust crate for working with URL query strings. It exposes exactly two functions: stringify, which turns a vector of key-value pairs into a query string, and querify, which parses a query string back into a vector of key-value pairs, silently skipping malformed segments.

The crate has no dependencies and no configuration surface. It is best suited for small utilities or embedded contexts where a single-purpose, easy-to-audit query-string helper is preferable to pulling in a larger URL-handling library.

What You Get

  • stringify to build an &key=value& query string from a Vec<(&str, &str)>
  • querify to parse a query string into a Vec<(&str, &str)>, ignoring malformed or incomplete pairs
  • Zero external dependencies — pure standard-library string splitting
  • Public type aliases QueryParam and QueryParams for consistent signatures across a codebase

Common Use Cases

  • Building a query string to append to an outgoing HTTP request URL
  • Parsing the query portion of an incoming request URL in a lightweight server or CLI tool
  • Round-tripping simple key-value parameters without pulling in a full URL-parsing crate
  • Prototyping or teaching contexts where a minimal, readable implementation is preferred over a feature-rich dependency

Under The Hood

Architecture The crate is a single src/lib.rs file exposing two pure, stateless functions built on the type aliases QueryParam and QueryParams. stringify folds a vector of tuples into a String with &-joined key=value segments, and querify splits an input string on & and then =, discarding any segment that doesn’t yield exactly two parts. There is no internal layering, no error type, and no allocation strategy beyond what String and Vec provide by default — the entire public surface is these two functions plus their type aliases.

Tech Stack The crate targets stable Rust via a standard Cargo.toml with no runtime dependencies declared. It ships as a crates.io package (querystring) with docs published to docs.rs, and has no build scripts, feature flags, or platform-specific code.

Code Quality There are no standalone test files in the repository; the only executable checks are assert_eq! calls embedded in the doc comments for stringify and querify, which run under cargo test --doc. There is no CI configuration, linter configuration, or CONTRIBUTING guide in the repo, and querify silently drops malformed segments rather than surfacing an error, so correctness for edge cases like percent-encoded or duplicate keys is left unverified.

API Design The public API is about as small and predictable as a two-function crate can be: no builder pattern, no configuration struct, and no percent-encoding/decoding — callers get raw string splitting and must handle encoding themselves. That keeps the learning curve near zero, but it also means the crate doesn’t handle the encoding edge cases that most real query strings contain.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search