diff --git a/CHANGELOG.md b/CHANGELOG.md index c352fb5..1b37b01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] ### Added -- `parse_env` attribute which is using for parse env variable in arbitrary type +- `parse_env` attribute for custom parsing of environment variables (allows you + to load lists and other complex objects from env vars). ## [0.2.0] - 2022-10-21 ### Added diff --git a/src/lib.rs b/src/lib.rs index f09873d..da44c22 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,11 +320,14 @@ pub use crate::{ /// - **`#[config(deserialize_with = path::to::function)]`**: like /// [serde's `deserialize_with` attribute][serde-deser]. /// -/// [serde-deser]: https://serde.rs/field-attrs.html#deserialize_with +/// - **`#[config(parse_env = path::to::function)]`**: function used to parse +/// environment variables. Mostly useful if you need to parse lists or +/// other complex objects from env vars. Function needs signature +/// `fn(&str) -> Result` where `T` is the type of +/// the field.. Can only be present if the `env` attribute is present. Also +/// see [`env::parse`]. /// -/// - **`#[config(from_env = path::to::function, env = "KEY")]`**: like -/// deserialize_with` attribute, but only for fields from an environment variable. -/// Can only be present if the `env` attribute is present +/// [serde-deser]: https://serde.rs/field-attrs.html#deserialize_with /// /// ## Special types for leaf fields ///