Rust Search

Find the best content on Rust, curated by the community; a search engine for Rustaceans.
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
"Writing return \<something\>; at the end of a function in Rust is a bit like answering the question "Do you like potatoes?" with "Yes, I like potatoes..."

Search tips

Type anything to search across articles, videos (including conference talks), podcasts, research, crates, and Rust API documentation. These operators give you finer control — click an example to try it.

Find pages containing all your words. Pages where the words appear together rank higher.
Quote part of your query to keep those words together as an exact phrase within a larger search.
Wrap the whole query in quotes for a verbatim search that matches text exactly, punctuation and all — perfect for Rust syntax. Needs at least 3 characters.
Put ! first to open the top result immediately. Quote the whole query for a literal leading bang, as in '!Send'. Bangs elsewhere, such as println!, stay literal. Browser and launcher shortcuts can invoke this directly. See search integrations.
Limit results to a single site. Works on its own () too. One site: per search.

Use the tabs and filters above the results to narrow by content type, publication year, and sort order.