Skip to content
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

Serialize comments #10

Open
flaviojs opened this issue Jul 4, 2019 · 0 comments
Open

Serialize comments #10

flaviojs opened this issue Jul 4, 2019 · 0 comments

Comments

@flaviojs
Copy link

flaviojs commented Jul 4, 2019

I have a json config file that has comments.
It is meant to be edited manually or with a GUI launcher.

Ideally there would be a way to roundtrip the comments in the launcher with rust but I can't find anything.

The minimum I need is a way to serialize default comments.
Maybe something like:

#[derive(Deserialize, Debug, Serialize)]
struct Config {
    #[json5(default_comment = "Number of milliseconds for one game cycle. Default: 25")]
    ms_per_game_cycle: i32,
}

would be serialized into something like:

{
  // Number of milliseconds for one game cycle. Default: 25
  "ms_per_game_cycle": 25
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant