File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2756,6 +2756,28 @@ impl Path {
27562756 iter_after ( self . components ( ) . rev ( ) , child. components ( ) . rev ( ) ) . is_some ( )
27572757 }
27582758
2759+ /// Checks whether the `Path` is empty.
2760+ ///
2761+ /// # Examples
2762+ ///
2763+ /// ```
2764+ /// #![feature(path_is_empty)]
2765+ /// use std::path::Path;
2766+ ///
2767+ /// let path = Path::new("");
2768+ /// assert!(path.is_empty());
2769+ ///
2770+ /// let path = Path::new("foo");
2771+ /// assert!(!path.is_empty());
2772+ ///
2773+ /// let path = Path::new(".");
2774+ /// assert!(!path.is_empty());
2775+ /// ```
2776+ #[ unstable( feature = "path_is_empty" , issue = "148494" ) ]
2777+ pub fn is_empty ( & self ) -> bool {
2778+ self . as_os_str ( ) . is_empty ( )
2779+ }
2780+
27592781 /// Extracts the stem (non-extension) portion of [`self.file_name`].
27602782 ///
27612783 /// [`self.file_name`]: Path::file_name
You can’t perform that action at this time.
0 commit comments