-
Notifications
You must be signed in to change notification settings - Fork 132
Feature request: preserve order in value #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@matklad this sounds very reasonable |
If support is added for an ordered map parsing mode, how would you like this functionality to be enabled? A macro? An object-format flag? One frustrating thing that could occur now is that the serialized format doesn't show whether it is meant to be parsed in "preserved order mode" or "ordered key mode." This could be problematic if we ever want to provide syntax highlighting support for RON. Should we consider schemas for this? |
@VermillionAzure as I understand this issue, it's not about parsing, it's about serialization only. The parser should work regardless, and no new extensions are needed. I think it can just be an option of the serializer (or a compile feature that enables it and adds dependency on |
@VermillionAzure Are you still interested in fixing this issue? |
Hello, does this will be implemented. I am not sure if i have the same issue, but when I Deserizlise, i do not have the same structure order.
and it does not preserve order of it, so that sometimes |
@lykhouzov if your tasks is a |
Hi, @kvark. So yes, it is
or maybe move a name of a task to task itself. |
@lykhouzov You could also just replace the |
Blocked by indexmap-rs/indexmap#91 |
172: Use indexmap to preserve order (optional) r=torkleyy a=torkleyy Introduces an optional `indexmap` feature which uses `IndexMap` in `Value::Map` to preserve the order of deserialized elements. Fixes #129 Co-authored-by: Thomas Schaller <[email protected]>
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.
The text was updated successfully, but these errors were encountered: