From 5d87006006953f74b2125c5fc75a551805ca2299 Mon Sep 17 00:00:00 2001 From: Wouter Geraedts Date: Sun, 13 Oct 2019 19:16:52 +0200 Subject: [PATCH] Implemented Path::is_relative --- src/path/path.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/path/path.rs b/src/path/path.rs index 7249f9d5..5146bc38 100644 --- a/src/path/path.rs +++ b/src/path/path.rs @@ -373,6 +373,23 @@ impl Path { .unwrap_or(false) } + /// Returns `true` if the `Path` is relative, i.e., not absolute. + /// + /// See [`is_absolute`]'s documentation for more details. + /// + /// # Examples + /// + /// ``` + /// use async_std::path::Path; + /// + /// assert!(Path::new("foo.txt").is_relative()); + /// ``` + /// + /// [`is_absolute`]: #method.is_absolute + pub fn is_relative(&self) -> bool { + self.inner.is_relative() + } + /// Queries the file system to get information about a file, directory, etc. /// /// This function will traverse symbolic links to query information about the