@@ -258,6 +258,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
258
258
/// None => println!("{key} is not defined in the environment.")
259
259
/// }
260
260
/// ```
261
+ ///
262
+ /// If expecting a delimited variable (such as `PATH`), [`split_paths`]
263
+ /// can be used to separate items.
261
264
#[ must_use]
262
265
#[ stable( feature = "env" , since = "1.0.0" ) ]
263
266
pub fn var_os < K : AsRef < OsStr > > ( key : K ) -> Option < OsString > {
@@ -441,6 +444,16 @@ pub struct SplitPaths<'a> {
441
444
/// Returns an iterator over the paths contained in `unparsed`. The iterator
442
445
/// element type is [`PathBuf`].
443
446
///
447
+ /// On most Unix 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 there is no delimited `PATH` variable,
455
+ /// such as UEFI.
456
+ ///
444
457
/// # Examples
445
458
///
446
459
/// ```
@@ -456,6 +469,7 @@ pub struct SplitPaths<'a> {
456
469
/// None => println!("{key} is not defined in the environment.")
457
470
/// }
458
471
/// ```
472
+ #[ doc( alias = "PATH" ) ]
459
473
#[ stable( feature = "env" , since = "1.0.0" ) ]
460
474
pub fn split_paths < T : AsRef < OsStr > + ?Sized > ( unparsed : & T ) -> SplitPaths < ' _ > {
461
475
SplitPaths { inner : os_imp:: split_paths ( unparsed. as_ref ( ) ) }
@@ -496,7 +510,8 @@ pub struct JoinPathsError {
496
510
///
497
511
/// Returns an [`Err`] (containing an error message) if one of the input
498
512
/// [`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).
500
515
///
501
516
/// # Examples
502
517
///
@@ -550,6 +565,7 @@ pub struct JoinPathsError {
550
565
/// ```
551
566
///
552
567
/// [`env::split_paths()`]: split_paths
568
+ #[ doc( alias = "PATH" ) ]
553
569
#[ stable( feature = "env" , since = "1.0.0" ) ]
554
570
pub fn join_paths < I , T > ( paths : I ) -> Result < OsString , JoinPathsError >
555
571
where
0 commit comments