parse_query
Parses a query string (a=1&b=two) into its key-value pairs, decoded, in order.
A leading ? is ignored. Pairs are separated by &; empty pairs are skipped; a pair without
= has an empty value; only the first = splits key from value. Repeated keys are all kept.
Both keys and values are decoded the way HTML forms are: + is a space and %XX is a byte.
Import
Section titled “Import”Cargo feature url (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
query | &str | The query string, with or without the leading ?. |
Returns
Section titled “Returns”Result<Vec<(String, String)>, PercentDecodeError> — Ok on success, otherwise an Err: see Errors.
Errors
Section titled “Errors”A PercentDecodeError for an invalid escape in a key or a value (its index is a byte
offset within that key or value).
Examples
Section titled “Examples”Error type: PercentDecodeError
Section titled “Error type: PercentDecodeError”Why a string could not be percent-decoded.
