From 3ad70390466a61908020109d405c2b503753d38a Mon Sep 17 00:00:00 2001 From: YushiOMOTE Date: Thu, 14 Jul 2022 20:24:07 +0900 Subject: [PATCH 1/2] Regenerate docs --- README.md | 3 ++- econf/src/lib.rs | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 96533b4..04074e0 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ struct A { Load a field with the given name instead of its Rust's field name. This is helpful if the environment variable name and Rust's field name don't match: -``` +```rust #[derive(LoadEnv)] struct A { x: bool, @@ -163,4 +163,5 @@ struct A { } ``` + License: MIT diff --git a/econf/src/lib.rs b/econf/src/lib.rs index 0508da3..6cb88b1 100644 --- a/econf/src/lib.rs +++ b/econf/src/lib.rs @@ -151,6 +151,19 @@ //! } //! ``` //! +//! # Renaming fields +//! +//! Load a field with the given name instead of its Rust's field name. This is helpful if the environment variable name and Rust's field name don't match: +//! +//! ``` +//! #[derive(LoadEnv)] +//! struct A { +//! x: bool, +//! #[econf(rename = "ANOTHER_Y")] +//! y: u64, // will be loaded from an environment variable `ANOTHER_Y` +//! } +//! ``` +//! use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque}; use std::hash::Hash; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; From d79d74ce10a458c5f0540c122d81e01ad6d213bf Mon Sep 17 00:00:00 2001 From: YushiOMOTE Date: Thu, 14 Jul 2022 20:51:09 +0900 Subject: [PATCH 2/2] Fix doctest --- econf/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/econf/src/lib.rs b/econf/src/lib.rs index 6cb88b1..18d7512 100644 --- a/econf/src/lib.rs +++ b/econf/src/lib.rs @@ -156,6 +156,7 @@ //! Load a field with the given name instead of its Rust's field name. This is helpful if the environment variable name and Rust's field name don't match: //! //! ``` +//! # use econf::LoadEnv; //! #[derive(LoadEnv)] //! struct A { //! x: bool,