@@ -28,18 +28,20 @@ fn make_case_insensitive_and_normalized_env(
2828 ( case_insensitive_env, normalized_env)
2929}
3030
31- /// A snapshot of the environment variables available to [`super:: GlobalContext`].
31+ /// A snapshot of the environment variables available to [`GlobalContext`].
3232///
33- /// Currently, the [`Context`](super::GlobalContext) supports lookup of environment variables
33+ /// Currently, the [`GlobalContext`] supports lookup of environment variables
3434/// through two different means:
3535///
36- /// - [`Context ::get_env`](super::GlobalContext::get_env)
37- /// and [`Context ::get_env_os`](super::GlobalContext::get_env_os)
36+ /// - [`GlobalContext ::get_env`](super::GlobalContext::get_env)
37+ /// and [`GlobalContext ::get_env_os`](super::GlobalContext::get_env_os)
3838/// for process environment variables (similar to [`std::env::var`] and [`std::env::var_os`]),
39- /// - Typed Config Value API via [`Context ::get`](super::GlobalContext::get).
39+ /// - Typed Config Value API via [`GlobalContext ::get`](super::GlobalContext::get).
4040/// This is only available for `CARGO_` prefixed environment keys.
4141///
4242/// This type contains the env var snapshot and helper methods for both APIs.
43+ ///
44+ /// [`GlobalContext`]: super::GlobalContext
4345#[ derive( Debug ) ]
4446pub struct Env {
4547 /// A snapshot of the process's environment variables.
@@ -68,8 +70,8 @@ impl Env {
6870 pub fn new ( ) -> Self {
6971 // ALLOWED: This is the only permissible usage of `std::env::vars{_os}`
7072 // within cargo. If you do need access to individual variables without
71- // interacting with `Config` system, please use `std::env::var{_os}`
72- // and justify the validity of the usage.
73+ // interacting with the config system in [`GlobalContext`] , please use
74+ // `std::env::var{_os}` and justify the validity of the usage.
7375 #[ allow( clippy:: disallowed_methods) ]
7476 let env: HashMap < _ , _ > = std:: env:: vars_os ( ) . collect ( ) ;
7577 let ( case_insensitive_env, normalized_env) = make_case_insensitive_and_normalized_env ( & env) ;
@@ -105,9 +107,10 @@ impl Env {
105107 self . env . keys ( ) . filter_map ( |k| k. to_str ( ) )
106108 }
107109
108- /// Get the value of environment variable `key` through the `Config` snapshot.
110+ /// Get the value of environment variable `key` through the snapshot in
111+ /// [`GlobalContext`](super::GlobalContext).
109112 ///
110- /// This can be used similarly to `std::env::var_os`.
113+ /// This can be used similarly to [ `std::env::var_os`] .
111114 /// On Windows, we check for case mismatch since environment keys are case-insensitive.
112115 pub fn get_env_os ( & self , key : impl AsRef < OsStr > ) -> Option < OsString > {
113116 match self . env . get ( key. as_ref ( ) ) {
@@ -152,7 +155,7 @@ impl Env {
152155 /// Get the value of environment variable `key` as a `&str`.
153156 /// Returns `None` if `key` is not in `self.env` or if the value is not valid UTF-8.
154157 ///
155- /// This is intended for use in private methods of `Config` ,
158+ /// This is intended for use in private methods of [`GlobalContext`](super::GlobalContext) ,
156159 /// and does not check for env key case mismatch.
157160 ///
158161 /// This is case-sensitive on Windows (even though environment keys on Windows are usually
@@ -172,7 +175,7 @@ impl Env {
172175
173176 /// Check if the environment contains `key`.
174177 ///
175- /// This is intended for use in private methods of `Config` ,
178+ /// This is intended for use in private methods of [`GlobalContext`](super::GlobalContext) ,
176179 /// and does not check for env key case mismatch.
177180 /// See the docstring of [`Env::get_str`] for more context.
178181 pub ( super ) fn contains_key ( & self , key : impl AsRef < OsStr > ) -> bool {
0 commit comments