Skip to content

Feature request: preserve order in value #129

Closed
@matklad

Description

@matklad

Currently, value is based on BTree map, which loses the original order of ron document. I think it makes sense to add an option to preserve order. I'd even say that if ron's primary purpose is to be a human-editable format, then order should be preserved by default. https://crates.io/crates/indexmap might come in handy do actually implement this.

Here's my specific use-case for ordering: I use ron to generate the AST for Rust. As such, I group related things, like types or expressions, together, and ideally I'd love to see the same order in the generated code. Alas, as I use a map for some part of my input, it doesn't work. I can swtich to a list of pairs for this case, but a mapping makes more sense.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions