bfil / toml-config

Loads and decodes TOML files into Rust structures
https://bfil.github.io/toml-config
MIT License
13 stars 2 forks source link

Expose parsing from toml::Value #1

Open kriomant opened 8 years ago

kriomant commented 8 years ago

Sometimes parsed toml::Value is already available and it is needed initialize config from it.

bfil commented 8 years ago

Can you check out if the following change would work for you?

https://github.com/bfil/toml-config/commit/1d75b0db450650caee6523ee895b5a8bb78fa1dc

It exposes a decode() method and allows the following: ConfigFactory::decode(toml_table)

If that works for you I can update the docs and release a new version.

kriomant commented 8 years ago

decode consumes toml_table parameter. It seems it is not needed.

bfil commented 8 years ago

It is used, it overrides the defaults from the config structure with the toml_table value, I'm not sure if that is what you mean?

kriomant commented 8 years ago

It is consuming which is not needed, not the parameter itself. You receive toml_table parameter by value while It seems reference will be enough.