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

Feature request: Serializing with comments #541

Closed
fxdave opened this issue Apr 7, 2023 · 1 comment
Closed

Feature request: Serializing with comments #541

fxdave opened this issue Apr 7, 2023 · 1 comment

Comments

@fxdave
Copy link

fxdave commented Apr 7, 2023

Thanks for the library. I use it in my project (https://github.com/fxdave/vonal-rust).
I'd like to have an option to generate comments with the keys.

Why

I create the config schema dynamically on the fly. I want to give an option to add comments to the keys. So I only need serialization. Deserialization of comments is not needed for me.

An idea for implementing it

I can imagine a Value::WithComment { value: Value, comment: String } variant.
For example:

table.insert("something", Value::WithComment {
    value: Value::String("some value")
    comment: String::from("Some comment")
})

// ...

table.to_string() // this would include the comment

Alternative syntax

Value::Boolean(true).with_comment("Some comment")

Comment placement

Always above the value.

# foo comment
foo = ""

# bar comment
[bar]
# baz comment
baz=false
# handling
# multiline
# strings
# would be nice 
lorem = "ipsum"
@epage
Copy link
Member

epage commented Apr 7, 2023

Closing as a duplicate of #376

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
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

2 participants