Expand description
Iterator over application/x-www-form-urlencoded name/value pairs.
Yields raw, undecoded byte slices — pass each one through
pct::decode with Mode::Form
to apply percent-decoding (and + → space) into a caller-provided
buffer. This keeps the iterator zero-allocation: every item still
borrows from the original input.
Matches the behavior of WHATWG URL form decoding for splitting:
pairs separated by &, names and values by the first =. A pair
with no = yields the entire pair as the name with an empty value.
Empty pairs (e.g. &&) are skipped.
§Example
use xocomil::query;
let pairs: Vec<_> = query::parse(b"a=1&b=hello+world&c").collect();
assert_eq!(pairs, &[
(&b"a"[..], &b"1"[..]),
(&b"b"[..], &b"hello+world"[..]),
(&b"c"[..], &b""[..]),
]);Structs§
- Query
Iter - Iterator over
(name, value)byte slices in a query string.
Functions§
- parse
- Parse a query string into an iterator of
(name, value)pairs.