Show relative example for Path ancestors
This commit is contained in:
parent
d19d7e2755
commit
a11c27925d
1 changed files with 7 additions and 0 deletions
|
@ -1992,6 +1992,13 @@ impl Path {
|
|||
/// assert_eq!(ancestors.next(), Some(Path::new("/foo")));
|
||||
/// assert_eq!(ancestors.next(), Some(Path::new("/")));
|
||||
/// assert_eq!(ancestors.next(), None);
|
||||
///
|
||||
/// let mut ancestors = Path::new("../foo/bar").ancestors();
|
||||
/// assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
|
||||
/// assert_eq!(ancestors.next(), Some(Path::new("../foo")));
|
||||
/// assert_eq!(ancestors.next(), Some(Path::new("..")));
|
||||
/// assert_eq!(ancestors.next(), Some(Path::new("")));
|
||||
/// assert_eq!(ancestors.next(), None);
|
||||
/// ```
|
||||
///
|
||||
/// [`None`]: ../../std/option/enum.Option.html#variant.None
|
||||
|
|
Loading…
Add table
Reference in a new issue