doc.rust-lang.org
pub fn has_root(&self) -> bool
Returns true if the Path has a root.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn file_stem(&self) -> Option<&OsStr>
Extracts the stem (non-extension) portion of self.file_name.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn file_prefix(&self) -> Option<&OsStr>
Extracts the prefix of self.file_name.
method
std
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn file_name(&self) -> Option<&OsStr>
Returns the final component of the Path, if there is one.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn extension(&self) -> Option<&OsStr>
Extracts the extension (without the leading dot) of self.file_name, if possible.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn exists(&self) -> bool
Returns true if the path points at an existing entity.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ends_with<P>(&self, child: P) -> bool
Determines whether child is a suffix of self.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn display(&self) -> Display<'_>
Returns an object that implements Display for safely printing paths that may contain non-Unicode data. This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the path please use Debug instead.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn components(&self) -> Components<'_>
Produces an iterator over the Components of the path.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn canonicalize(&self) -> io::Result<PathBuf>
Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.
method
std
Stable since 1.5.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_os_str(&self) -> &OsStr
Yields the underlying OsStr slice.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_mut_os_str(&mut self) -> &mut OsStr
Yields a mutable reference to the underlying OsStr slice.
method
std
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn ancestors(&self) -> Ancestors<'_>
Produces an iterator over Path and its ancestors.
method
std
Stable since 1.28.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Path
A slice of a path (akin to str).
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const MAIN_SEPARATOR_STR: &str
The primary separator of path components for the current platform, represented as a &str; for example, this is "/" on Unix and "\\" on Windows.
constant
std
Stable since 1.68.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const MAIN_SEPARATOR: char
The primary separator of path components for the current platform, represented as a char; for example, this is '/' on Unix and '\\' on Windows.
constant
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_path(&self) -> &'a Path
Extracts a slice corresponding to the portion of the path remaining for iteration.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Iter<'a>
An iterator over the Components of a Path, as OsStr slices.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Display<'a>
Helper struct for safely printing paths with format! and {}.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_path(&self) -> &'a Path
Extracts a slice corresponding to the portion of the path remaining for iteration.
method
std
Stable since 1.0.0
Version 1.100.0-nightly