rust-ini icon indicating copy to clipboard operation
rust-ini copied to clipboard

Serde Support

Open Michael-F-Bryan opened this issue 7 years ago • 7 comments

What are your thoughts on adding serde support so you can serialize to/deserialize from an INI file? Along the same lines as serde_json, toml, or serde_xml.

Michael-F-Bryan avatar Dec 22 '17 14:12 Michael-F-Bryan

Well, INI file format is a flat format, which is a pure and simple key-value structure. So I don't think it is necessary to be used with serde. Ini is just a two level HashMap.

zonyitoo avatar Dec 24 '17 04:12 zonyitoo

I think it's nice to have! It's much cleaner and simpler to let serde parse the values into the correct types, instead of doing that by hand.

So I would think this is worth supporting.

hellow554 avatar Jun 03 '19 11:06 hellow554

PR is welcomed. Because I don't have time recently :(

zonyitoo avatar Jun 03 '19 13:06 zonyitoo

I'll try to do this, though I can't guarantee I'll have the time either.

kirawi avatar Sep 11 '21 17:09 kirawi

I would also like this. I am trying my hands at it but proc_macro stuff is not something i have worked with before. made some progress, i can deserialize to basic String and Option<String>, but not sections.

My goal is to support sections and allow duplicate ones to make a Vec<...> out of it.

@kirawi have you made any progress?

Other than that, great crate, it's the only one that supported the ini files i am trying to parse that i could find, and quite straight forward:)

EDIT: Forgot to mention that it's not using serde right now, just doing it "manually" so to speak.

Zerowalker avatar Nov 20 '21 00:11 Zerowalker

Honestly, I'll admit I completely forgot 😅 you can go ahead.

kirawi avatar Nov 20 '21 00:11 kirawi

Haha xd Well will do my best, but don't expect much;)

Zerowalker avatar Nov 20 '21 00:11 Zerowalker