1313//! This module contains functions to inspect various aspects such as
1414//! environment variables, process arguments, the current directory, and various
1515//! other important directories.
16+ //!
17+ //! There are several functions and structs in this module that have a
18+ //! counterpart ending in `os`. Those ending in `os` will return an [`OsString`]
19+ //! and those without will be returning a [`String`].
20+ //!
21+ //! [`OsString`]: ../../std/ffi/struct.OsString.html
22+ //! [`String`]: ../string/struct.String.html
1623
1724#![ stable( feature = "env" , since = "1.0.0" ) ]
1825
@@ -74,15 +81,17 @@ pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
7481
7582/// An iterator over a snapshot of the environment variables of this process.
7683///
77- /// This structure is created through the [`std::env::vars`] function.
84+ /// This structure is created by the [`std::env::vars`] function. See its
85+ /// documentation for more.
7886///
7987/// [`std::env::vars`]: fn.vars.html
8088#[ stable( feature = "env" , since = "1.0.0" ) ]
8189pub struct Vars { inner : VarsOs }
8290
8391/// An iterator over a snapshot of the environment variables of this process.
8492///
85- /// This structure is created through the [`std::env::vars_os`] function.
93+ /// This structure is created by the [`std::env::vars_os`] function. See
94+ /// its documentation for more.
8695///
8796/// [`std::env::vars_os`]: fn.vars_os.html
8897#[ stable( feature = "env" , since = "1.0.0" ) ]
@@ -176,12 +185,10 @@ impl fmt::Debug for VarsOs {
176185
177186/// Fetches the environment variable `key` from the current process.
178187///
179- /// The returned result is [`Ok(s)`] if the environment variable is present and is
180- /// valid unicode. If the environment variable is not present, or it is not
181- /// valid unicode, then [`VarError`] will be returned.
188+ /// # Errors
182189///
183- /// [`Ok(s)`]: ../result/enum.Result.html#variant.Ok
184- /// [`VarError`]: enum.VarError.html
190+ /// * Environment variable is not present
191+ /// * Environment variable is not valid unicode
185192///
186193/// # Examples
187194///
@@ -233,7 +240,8 @@ fn _var_os(key: &OsStr) -> Option<OsString> {
233240 } )
234241}
235242
236- /// Possible errors from the [`env::var`] function.
243+ /// The error type for operations interacting with environment variables.
244+ /// Possibly returned from the [`env::var`] function.
237245///
238246/// [`env::var`]: fn.var.html
239247#[ derive( Debug , PartialEq , Eq , Clone ) ]
@@ -356,10 +364,13 @@ fn _remove_var(k: &OsStr) {
356364 } )
357365}
358366
359- /// An iterator over `PathBuf` instances for parsing an environment variable
360- /// according to platform-specific conventions.
367+ /// An iterator that splits an environment variable into paths according to
368+ /// platform-specific conventions.
361369///
362- /// This structure is returned from `std::env::split_paths`.
370+ /// This structure is created by the [`std::env::split_paths`] function See its
371+ /// documentation for more.
372+ ///
373+ /// [`std::env::split_paths`]: fn.split_paths.html
363374#[ stable( feature = "env" , since = "1.0.0" ) ]
364375pub struct SplitPaths < ' a > { inner : os_imp:: SplitPaths < ' a > }
365376
@@ -402,8 +413,10 @@ impl<'a> fmt::Debug for SplitPaths<'a> {
402413 }
403414}
404415
405- /// Error type returned from `std::env::join_paths` when paths fail to be
406- /// joined.
416+ /// The error type for operations on the `PATH` variable. Possibly returned from
417+ /// the [`env::join_paths`] function.
418+ ///
419+ /// [`env::join_paths`]: fn.join_paths.html
407420#[ derive( Debug ) ]
408421#[ stable( feature = "env" , since = "1.0.0" ) ]
409422pub struct JoinPathsError {
@@ -413,7 +426,7 @@ pub struct JoinPathsError {
413426/// Joins a collection of [`Path`]s appropriately for the `PATH`
414427/// environment variable.
415428///
416- /// Returns an [`OsString`] on success.
429+ /// # Errors
417430///
418431/// Returns an [`Err`][err] (containing an error message) if one of the input
419432/// [`Path`]s contains an invalid character for constructing the `PATH`
@@ -493,12 +506,16 @@ pub fn home_dir() -> Option<PathBuf> {
493506
494507/// Returns the path of a temporary directory.
495508///
496- /// On Unix, returns the value of the `TMPDIR` environment variable if it is
509+ /// # Unix
510+ ///
511+ /// Returns the value of the `TMPDIR` environment variable if it is
497512/// set, otherwise for non-Android it returns `/tmp`. If Android, since there
498513/// is no global temporary folder (it is usually allocated per-app), it returns
499514/// `/data/local/tmp`.
500515///
501- /// On Windows, returns the value of, in order, the `TMP`, `TEMP`,
516+ /// # Windows
517+ ///
518+ /// Returns the value of, in order, the `TMP`, `TEMP`,
502519/// `USERPROFILE` environment variable if any are set and not the empty
503520/// string. Otherwise, `temp_dir` returns the path of the Windows directory.
504521/// This behavior is identical to that of [`GetTempPath`][msdn], which this
0 commit comments