Skip to content

Add methods on Map and Value to destroy preserved ordering#1199

Merged
dtolnay merged 1 commit intoserde-rs:masterfrom
dtolnay:sort
Oct 17, 2024
Merged

Add methods on Map and Value to destroy preserved ordering#1199
dtolnay merged 1 commit intoserde-rs:masterfrom
dtolnay:sort

Conversation

@dtolnay
Copy link
Member

@dtolnay dtolnay commented Oct 17, 2024

Closes #1014.

///
/// Other maps nested within the values of this map are not sorted. If you
/// need the entire data structure to be sorted at all levels, you must also
/// call `map.`[`values_mut`]`().for_each(`[`Value::sort_all_objects`]`)`.
Copy link
Member Author

@dtolnay dtolnay Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rendered badly but I filed rust-lang/rust#131845 to follow up in rustdoc. The standard library is also impacted.

@dtolnay dtolnay merged commit 2679e30 into serde-rs:master Oct 17, 2024
@dtolnay dtolnay deleted the sort branch October 17, 2024 18:02
takumi-earth pushed a commit to earthlings-dev/json that referenced this pull request Jan 27, 2026
Add methods on Map and Value to destroy preserved ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add a .sort() method to expose IndexMap::sort_keys()

1 participant