Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update top-level path doc examples to show results.
  • Loading branch information
frewsxcv committed Nov 14, 2016
1 parent 766f6e4 commit af1aa1b
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions src/libstd/path.rs
Expand Up @@ -25,11 +25,18 @@
//!
//! ```rust
//! use std::path::Path;
//! use std::ffi::OsStr;
//!
//! let path = Path::new("/tmp/foo/bar.txt");
//! let file = path.file_name();
//!
//! let parent = path.parent();
//! assert_eq!(parent, Some(Path::new("/tmp/foo")));
//!
//! let file_stem = path.file_stem();
//! assert_eq!(file_stem, Some(OsStr::new("bar")));
//!
//! let extension = path.extension();
//! let parent_dir = path.parent();
//! assert_eq!(extension, Some(OsStr::new("txt")));
//! ```
//!
//! To build or modify paths, use `PathBuf`:
Expand Down Expand Up @@ -1319,13 +1326,19 @@ impl AsRef<OsStr> for PathBuf {
///
/// ```
/// use std::path::Path;
/// use std::ffi::OsStr;
///
/// let path = Path::new("/tmp/foo/bar.txt");
/// let file = path.file_name();
///
/// let parent = path.parent();
/// assert_eq!(parent, Some(Path::new("/tmp/foo")));
///
/// let file_stem = path.file_stem();
/// assert_eq!(file_stem, Some(OsStr::new("bar")));
///
/// let extension = path.extension();
/// let parent_dir = path.parent();
/// assert_eq!(extension, Some(OsStr::new("txt")));
/// ```
///
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Path {
inner: OsStr,
Expand Down

0 comments on commit af1aa1b

Please sign in to comment.