Improve documentation

This commit is contained in:
Lukas Kalbertodt
2022-11-06 12:24:10 +01:00
parent 49828fc2e3
commit 9d57b048ce
2 changed files with 9 additions and 5 deletions

View File

@@ -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

View File

@@ -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<T, impl std::error::Error>` 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
///