config-rs v0.7.0 Release Notes

Release Date: 2017-08-05 // over 6 years ago
    • Fix conflict with serde_yaml. #39

    • Implement Source for Config.

    • Implement serde::de::Deserializer for Config. my_config.deserialize may now be called as either Deserialize::deserialize(my_config) or my_config.try_into().

    • Remove ConfigResult. The builder pattern requires either .try_into as the final step or the initial Config::new() to be bound to a slot. Errors must also be handled on each call instead of at the end of the chain.

      let mut c = Config::new();
      c
          .merge(File::with_name("Settings")).unwrap()
          .merge(Environment::with_prefix("APP")).unwrap();
      
      let c = Config::new()
          .merge(File::with_name("Settings")).unwrap()
          .merge(Environment::with_prefix("APP")).unwrap()
          // LLVM should be smart enough to remove the actual clone operation
          // as you are cloning a temporary that is dropped at the same time
          .clone();
      
      let mut s: Settings = Config::new()
          .merge(File::with_name("Settings")).unwrap()
          .merge(Environment::with_prefix("APP")).unwrap()
          .try_into();