From: bors Date: Wed, 30 May 2018 20:12:02 +0000 (+0000) Subject: Auto merge of #5552 - ehuss:config-serde, r=alexcrichton X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5fc6eadc362e52c885a8cf24b924be53467fe65f;p=cargo.git Auto merge of #5552 - ehuss:config-serde, r=alexcrichton Typed Config Access This introduces a new API for accessing config values using serde to automatically convert to a destination type. By itself this shouldn't introduce any behavioral changes (except for some slight wording changes to error messages). However, it unlocks the ability to use richer data types in the future (such as `profile`, or `source`). Example: ```rust let p: Option = config.get("profile.dev")?; ``` Supports environment variables when fetching structs or maps. Note that it can support underscores in env var for struct field names, but not maps. So for example, "opt_level" works, but not "serde_json" (example: `CARGO_PROFILE_DEV_OVERRIDES_serde_OPT_LEVEL`). I don't have any ideas for a workaround (though I feel this is an overuse of env vars). It supports environment variables for lists. The value in the env var will get appended to anything in the config. It uses TOML syntax, and currently only supports strings. Example: `CARGO_FOO=['a', 'b']`. I did *not* modify `get_list` to avoid changing behavior, but that can easily be changed. --- 5fc6eadc362e52c885a8cf24b924be53467fe65f