doc.rust-lang.org
pub fn to_string_lossy(&self) -> Cow<'_, str>
Converts a Path to a Cow<str>.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_str(&self) -> Option<&str>
Yields a &str slice if the Path is valid unicode.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn to_path_buf(&self) -> PathBuf
Converts a Path to an owned PathBuf.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn symlink_metadata(&self) -> io::Result<fs::Metadata>
Queries the metadata about a file without following symlinks.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn strip_prefix<P>(&self, base: P) -> Result<&Path, StripPrefixError>
Returns a path that, when joined onto base, yields self.
method
std
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn starts_with<P>(&self, base: P) -> bool
Determines whether base is a prefix of self.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn read_link(&self) -> io::Result<PathBuf>
Reads a symbolic link, returning the file that the link points to.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn read_dir(&self) -> io::Result<fs::ReadDir>
Returns an iterator over the entries within a directory.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn parent(&self) -> Option<&Path>
Returns the Path without its final component, if there is one.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new<S>(s: &S) -> &Path
Directly wraps a string slice as a Path slice.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn metadata(&self) -> io::Result<fs::Metadata>
Queries the file system to get information about a file, directory, etc.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn join<P>(&self, path: P) -> PathBuf
Creates an owned PathBuf with path adjoined to self.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn iter(&self) -> Iter<'_>
Produces an iterator over the path's components viewed as OsStr slices.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_symlink(&self) -> bool
Returns true if the path exists on disk and is pointing at a symbolic link.
method
std
Stable since 1.58.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_relative(&self) -> bool
Returns true if the Path is relative, i.e., not absolute.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_file(&self) -> bool
Returns true if the path exists on disk and is pointing at a regular file.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_empty(&self) -> bool
Checks whether the Path is empty.
method
std
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_dir(&self) -> bool
Returns true if the path exists on disk and is pointing at a directory.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_absolute(&self) -> bool
Returns true if the Path is absolute, i.e., if it is independent of the current directory.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_path_buf(self: Box<Self>) -> PathBuf
Converts a Box<Path> into a PathBuf without copying or allocating.
method
std
Stable since 1.20.0
Version 1.100.0-nightly