-
Notifications
You must be signed in to change notification settings - Fork 21
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
Serde support? #33
Comments
The question isn't can but why? If you have a use-case for it, I think we can think about possibilities as to why we should be adding it as a feature. |
Well, I wanted to have the data be represented as hard-typed structs but doing that without Serde seems to be verbosyy ^^ |
Yes. Hard typed structures is also a use case for us. This library is actually very hard to use and very verbose without some kind of derive based structure deserialization. Serde is just the easiest framework to implement this, and already a pseudo-standard in the Rust ecosystem. What I want is something like: #[derive(Deserialize)] // Could be from configparser, but would prefer serde.
pub struct Config {
pub some_config: String,
pub some_other_config: Option<u32>,
}
impl Config {
pub fn load(path: impl AsRef<Path>) -> Result<Self, HereBeErrType> {
let str = std::fs::read_to_string(path)?;
configparser::parse::<Self>(&str)
}
} |
The work is now underway, I think as the wider ecosystem expands to use |
Aaa thank you so much! |
An easy way might be to use `serde_json`, parse our unparsed string and
return the generic type? It is inefficient but doesn't require rebuilding
the wheel.
~~
…On Mon, 3 Jul 2023 at 01:46, natasria ***@***.***> wrote:
Aaa thank you so much!
—
Reply to this email directly, view it on GitHub
<#33 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJWRQRB3ZULUCGN6YII6ZLXOHT3DANCNFSM6AAAAAARMAYPOY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi! Can we have serde support in configparser?
The text was updated successfully, but these errors were encountered: