Skip to content

Commit 95abeb0

Browse files
authored
Rollup merge of #60022 - nathankleyn:fix-issue-59543, r=Centril
Document `Item` type in `std::env::SplitPaths` iterator. Previously there wasn't any documentation to show what the type of `Item` was inside `std::env::SplitPaths`. Now, in the same format as other examples of docs in `std` for `Iterator#Item`, we mention the type. This fixes #59543. r? @steveklabnik
2 parents 5f0dc0e + 8951eea commit 95abeb0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libstd/env.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,21 @@ fn _remove_var(k: &OsStr) {
359359
/// An iterator that splits an environment variable into paths according to
360360
/// platform-specific conventions.
361361
///
362+
/// The iterator element type is [`PathBuf`].
363+
///
362364
/// This structure is created by the [`std::env::split_paths`] function. See its
363365
/// documentation for more.
364366
///
367+
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
365368
/// [`std::env::split_paths`]: fn.split_paths.html
366369
#[stable(feature = "env", since = "1.0.0")]
367370
pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
368371

369372
/// Parses input according to platform conventions for the `PATH`
370373
/// environment variable.
371374
///
372-
/// Returns an iterator over the paths contained in `unparsed`.
375+
/// Returns an iterator over the paths contained in `unparsed`. The iterator
376+
/// element type is [`PathBuf`].
373377
///
374378
/// # Examples
375379
///
@@ -386,6 +390,8 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
386390
/// None => println!("{} is not defined in the environment.", key)
387391
/// }
388392
/// ```
393+
///
394+
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
389395
#[stable(feature = "env", since = "1.0.0")]
390396
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
391397
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }

0 commit comments

Comments
 (0)