Skip to content

Commit

Permalink
Document Item type in std::env::SplitPaths iterator.
Browse files Browse the repository at this point in the history
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 `srd` for `Iterator#Item`, we mention the
type.

This fixes #59543.
  • Loading branch information
nathankleyn committed Apr 17, 2019
1 parent 70f1309 commit 8951eea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,21 @@ fn _remove_var(k: &OsStr) {
/// An iterator that splits an environment variable into paths according to
/// platform-specific conventions.
///
/// The iterator element type is [`PathBuf`].
///
/// This structure is created by the [`std::env::split_paths`] function. See its
/// documentation for more.
///
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
/// [`std::env::split_paths`]: fn.split_paths.html
#[stable(feature = "env", since = "1.0.0")]
pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }

/// Parses input according to platform conventions for the `PATH`
/// environment variable.
///
/// Returns an iterator over the paths contained in `unparsed`.
/// Returns an iterator over the paths contained in `unparsed`. The iterator
/// element type is [`PathBuf`].
///
/// # Examples
///
Expand All @@ -386,6 +390,8 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
/// None => println!("{} is not defined in the environment.", key)
/// }
/// ```
///
/// [`PathBuf`]: ../../std/path/struct.PathBuf.html
#[stable(feature = "env", since = "1.0.0")]
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
Expand Down

0 comments on commit 8951eea

Please sign in to comment.