Skip to content

Commit 5d87006

Browse files
committed
Implemented Path::is_relative
1 parent df9a01f commit 5d87006

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/path/path.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,23 @@ impl Path {
373373
.unwrap_or(false)
374374
}
375375

376+
/// Returns `true` if the `Path` is relative, i.e., not absolute.
377+
///
378+
/// See [`is_absolute`]'s documentation for more details.
379+
///
380+
/// # Examples
381+
///
382+
/// ```
383+
/// use async_std::path::Path;
384+
///
385+
/// assert!(Path::new("foo.txt").is_relative());
386+
/// ```
387+
///
388+
/// [`is_absolute`]: #method.is_absolute
389+
pub fn is_relative(&self) -> bool {
390+
self.inner.is_relative()
391+
}
392+
376393
/// Queries the file system to get information about a file, directory, etc.
377394
///
378395
/// This function will traverse symbolic links to query information about the

0 commit comments

Comments
 (0)