@@ -258,6 +258,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
258258/// None => println!("{key} is not defined in the environment.")
259259/// }
260260/// ```
261+ ///
262+ /// If expecting a delimited variable (such as `PATH`), [`split_paths`]
263+ /// can be used to separate items.
261264#[ must_use]
262265#[ stable( feature = "env" , since = "1.0.0" ) ]
263266pub fn var_os < K : AsRef < OsStr > > ( key : K ) -> Option < OsString > {
@@ -441,6 +444,16 @@ pub struct SplitPaths<'a> {
441444/// Returns an iterator over the paths contained in `unparsed`. The iterator
442445/// element type is [`PathBuf`].
443446///
447+ /// On most unis platforms, the separator is `:` and on Windows it is `;`. This
448+ /// also performs unquoting on Windows.
449+ ///
450+ /// [`join_paths`] can be used to recombine elements.
451+ ///
452+ /// # Panics
453+ ///
454+ /// This will panic on systems where theere is no delimited `PATH` variable,
455+ /// such as UEFI.
456+ ///
444457/// # Examples
445458///
446459/// ```
@@ -456,6 +469,7 @@ pub struct SplitPaths<'a> {
456469/// None => println!("{key} is not defined in the environment.")
457470/// }
458471/// ```
472+ #[ doc( alias = "PATH" ) ]
459473#[ stable( feature = "env" , since = "1.0.0" ) ]
460474pub fn split_paths < T : AsRef < OsStr > + ?Sized > ( unparsed : & T ) -> SplitPaths < ' _ > {
461475 SplitPaths { inner : os_imp:: split_paths ( unparsed. as_ref ( ) ) }
@@ -496,7 +510,8 @@ pub struct JoinPathsError {
496510///
497511/// Returns an [`Err`] (containing an error message) if one of the input
498512/// [`Path`]s contains an invalid character for constructing the `PATH`
499- /// variable (a double quote on Windows or a colon on Unix).
513+ /// variable (a double quote on Windows or a colon on Unix), or if the system
514+ /// does not have a `PATH`-like variable (e.g. UEFI or WASI).
500515///
501516/// # Examples
502517///
@@ -550,6 +565,7 @@ pub struct JoinPathsError {
550565/// ```
551566///
552567/// [`env::split_paths()`]: split_paths
568+ #[ doc( alias = "PATH" ) ]
553569#[ stable( feature = "env" , since = "1.0.0" ) ]
554570pub fn join_paths < I , T > ( paths : I ) -> Result < OsString , JoinPathsError >
555571where
0 commit comments