PathBufD

Struct PathBufD 

Source
pub struct PathBufD(/* private fields */);
Expand description

PathBuf wrapper

Implementations§

Source§

impl PathBufD

Source

pub fn new() -> Self

Creates a new PathBufD

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new PathBufD with a given capacity.

Source

pub fn current() -> Self

Creates a new PathBufD in the current directory

Source

pub fn as_path(&self) -> &Path

Coerces to a Path slice.

Source

pub fn as_bytes(&self) -> Vec<u8>

Gets Vec<u8> representation of the inner string.

Source

pub fn push<P>(&mut self, path: P)
where P: AsRef<Path>,

Extends self with path.

Source

pub fn join<P>(&self, path: P) -> Self
where P: AsRef<Path>,

Creates an owned PathBufD with path adjoined to self.

Source

pub fn pop(&mut self) -> bool

Truncates self to self.parent

Returns false and does nothing if self.parent is None. Otherwise, returns true.

Source

pub fn set_file_name<S>(&mut self, file_name: S)
where S: AsRef<OsStr>,

Updates self.file_name to file_name

Source

pub fn set_extension<S>(&mut self, extension: S)
where S: AsRef<OsStr>,

Updates self.extension to Some(extension) or to None if extension is empty.

Source

pub fn as_mut_os_string(&mut self) -> &mut OsString

Yields a mutable reference to the underlying OsString instance.

Source

pub fn into_os_string(self) -> OsString

Consumes the PathBufD, yielding its internal OsString storage.

Source

pub fn into_boxed_path(self) -> Box<Path>

Converts this PathBufD into a boxed Path.

Source

pub fn capacity(&self) -> usize

Invokes [capacity] on the underlying instance of OsString.

Source

pub fn clear(&mut self)

Invokes clear on the underlying instance of OsString.

Source

pub fn reserve(&mut self, additional: usize)

Invokes reserve on the underlying instance of OsString.

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Invokes try_reserve on the underlying instance of OsString.

Source

pub fn reserve_exact(&mut self, additional: usize)

Invokes reserve_exact on the underlying instance of OsString.

Source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Invokes try_reserve_exact on the underlying instance of OsString.

Source

pub fn shrink_to_fit(&mut self)

Invokes shrink_to_fit on the underlying instance of OsString.

Source

pub fn shrink_to(&mut self, min_capacity: usize)

Invokes shrink_to on the underlying instance of OsString.

Source

pub fn extend<P>(self, paths: &[P]) -> Self
where P: AsRef<Path>,

Creates an owned PathBufD with all paths from paths adjoined to self.

Trait Implementations§

Source§

impl AsRef<Path> for PathBufD

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for PathBufD

Source§

fn clone(&self) -> PathBufD

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PathBufD

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PathBufD

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for PathBufD

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for PathBufD

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<PathBufD> for PathBuf

Source§

fn from(value: PathBufD) -> Self

Converts to this type from the input type.
Source§

impl Into<PathBufD> for PathBuf

Source§

fn into(self) -> PathBufD

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for PathBufD

Source§

fn eq(&self, other: &PathBufD) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PathBufD

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for PathBufD

Source§

impl StructuralPartialEq for PathBufD

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,