doc.rust-lang.org
pub fn set_extension<S>(&mut self, extension: S) -> bool
Updates self.extension to Some(extension) or to None if extension is empty.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve_exact(&mut self, additional: usize)
Invokes reserve_exact on the underlying instance of OsString.
method
std
Stable since 1.44.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn reserve(&mut self, additional: usize)
Invokes reserve on the underlying instance of OsString.
method
std
Stable since 1.44.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn push<P>(&mut self, path: P)
Extends self with path.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn pop(&mut self) -> bool
Truncates self to self.parent.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new() -> PathBuf
Allocates an empty PathBuf.
associated_function
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn leak<'a>(self) -> &'a mut Path
Consumes and leaks the PathBuf, returning a mutable reference to the contents, &'a mut Path.
method
std
Stable since 1.89.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_string(self) -> Result<String, PathBuf>
Converts the PathBuf into a String if it contains valid Unicode data.
method
std
Stable since 1.98.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_os_string(self) -> OsString
Consumes the PathBuf, yielding its internal OsString storage.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn into_boxed_path(self) -> Box<Path>
Converts this PathBuf into a boxed Path.
method
std
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn clear(&mut self)
Invokes clear on the underlying instance of OsString.
method
std
Stable since 1.44.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn capacity(&self) -> usize
Invokes capacity on the underlying instance of OsString.
method
std
Stable since 1.44.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_path(&self) -> &Path
Coerces to a Path slice.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn as_mut_os_string(&mut self) -> &mut OsString
Yields a mutable reference to the underlying OsString instance.
method
std
Stable since 1.70.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn add_extension<S>(&mut self, extension: S) -> bool
Append self.extension with extension.
method
std
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct PathBuf
An owned, mutable path (akin to String).
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_file_name<S>(&self, file_name: S) -> PathBuf
Creates an owned PathBuf like self but with the given file name.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_extension<S>(&self, extension: S) -> PathBuf
Creates an owned PathBuf like self but with the given extension.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn with_added_extension<S>(&self, extension: S) -> PathBuf
Creates an owned PathBuf like self but with the extension added.
method
std
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn try_exists(&self) -> io::Result<bool>
Returns Ok(true) if the path points at an existing entity.
method
std
Stable since 1.63.0
Version 1.100.0-nightly