Show relative example for Path ancestors
This commit is contained in:
parent
d19d7e2755
commit
a11c27925d
@ -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…
Reference in New Issue
Block a user