samscott89 / serde_qs

Serde support for querystring-style strings
Apache License 2.0
193 stars 68 forks source link

Support preserving order of parameters when serializing to a Map. #106

Open wuerges opened 5 months ago

wuerges commented 5 months ago

Dear samscott89, Please consider this pull request.

What it does?

This PR adds support for deserializing queries into ordered maps, such as IndexMap.

How?

It adds a new feature, called indexmap, that replaces the BTreeMap used internall by serd_qs with an IndexMap.

Why?

Sometimes the order of the keys in the query is important. On example is sorting. What if you want to sort by one field, and then by other?

Was it tested?

There's a new test. It parses a two queries into a map. The queries are almost the same, but the order of the keys is swapped.

davidrjonas commented 1 week ago

Hey, this is exactly what I need! Any chance this will be merged soon?