serde-rs / serde-rs/json

Should Map::{iter[_mut], keys, values[_mut]} guarantee the same iteration order?

Open
#554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
670
PR merge metrics
No merged PRs in 30d

Description

.keys() and .values() having the same iteration order is something that is guaranteed by both BTreeMap (iteration order is always key order) and IndexMap (iteration order is always "the order", determined by insertion sequence and any calls to .sort_by(). Is this something that serde_json could / should guarantee as well?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the serde_json Map API, especially iter, keys, values, iter_mut, and values_mut, and compare the ordering behavior described for BTreeMap and IndexMap. No source file or test is named; done requires a maintainer decision on whether matching iteration order should be guaranteed and the corresponding behavior or documentation to reflect that decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.