Skip to content

Commit

Permalink
doc: improve as_path example
Browse files Browse the repository at this point in the history
  • Loading branch information
tshepang committed Aug 26, 2015
1 parent 7472886 commit cf3d6b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libstd/path.rs
Expand Up @@ -632,9 +632,11 @@ impl<'a> Components<'a> {
/// ```
/// use std::path::Path;
///
/// let path = Path::new("/tmp/foo/bar.txt");
/// let mut components = Path::new("/tmp/foo/bar.txt").components();
/// components.next();
/// components.next();
///
/// println!("{:?}", path.components().as_path());
/// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn as_path(&self) -> &'a Path {
Expand Down

0 comments on commit cf3d6b5

Please sign in to comment.