[−][src]Struct smart_path::SmartPathBuf
Methods
impl SmartPathBuf[src]
pub fn new() -> SmartPathBuf[src]
pub fn as_path(&self) -> &Path[src]
pub fn len(&self) -> usize[src]
pub fn is_empty(&self) -> bool[src]
pub fn push<P: AsRef<Path>>(&mut self, path: P)[src]
When pushing segments to a new SmartPathBuf first push sets the initial size,
using one of the from methods also sets initial size.
Example
use std::path::PathBuf; use smart_path::SmartPathBuf; let mut path = SmartPathBuf::new(); path.push("hello/world/bye"); // or let mut path = SmartPathBuf::from("hello/world/bye"); path.push("more/stuff"); path.initial(); assert_eq!(path.as_path(), PathBuf::from("hello/world/bye").as_path());
pub fn pop(&mut self) -> bool[src]
Remove segment from end of path.
pub fn pop_last(&mut self)[src]
Remove the last added segment(s) from end of path.
Example
use std::path::PathBuf; use smart_path::SmartPathBuf; let mut path = SmartPathBuf::new(); path.push("hello/world/bye"); path.push("more/stuff"); path.pop_last(); assert_eq!(path.as_path(), PathBuf::from("hello/world/bye").as_path());
pub fn initial(&mut self)[src]
pub fn set_file_name<S: AsRef<OsStr>>(&mut self, file_name: S)[src]
pub fn set_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool[src]
pub fn into_boxed_path(self) -> Box<Path>[src]
pub fn into_os_string(self) -> OsString[src]
Trait Implementations
impl PathRange<RangeFull> for SmartPathBuf[src]
impl PathRange<RangeTo<usize>> for SmartPathBuf[src]
impl PathRange<RangeFrom<usize>> for SmartPathBuf[src]
fn range(&self, range: RangeFrom<usize>) -> Self[src]
Returns a new SmartPath from the range provided
impl PathRange<Range<usize>> for SmartPathBuf[src]
impl<'_, T: ?Sized> From<&'_ T> for SmartPathBuf where
T: AsRef<OsStr>, [src]
T: AsRef<OsStr>,
fn from(s: &T) -> SmartPathBuf[src]
impl From<OsString> for SmartPathBuf[src]
fn from(s: OsString) -> SmartPathBuf[src]
impl From<String> for SmartPathBuf[src]
fn from(s: String) -> SmartPathBuf[src]
impl From<PathBuf> for SmartPathBuf[src]
fn from(s: PathBuf) -> SmartPathBuf[src]
impl Clone for SmartPathBuf[src]
fn clone(&self) -> SmartPathBuf[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Default for SmartPathBuf[src]
impl PartialEq<SmartPathBuf> for SmartPathBuf[src]
impl Debug for SmartPathBuf[src]
impl FromStr for SmartPathBuf[src]
type Err = Infallible
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>[src]
impl Deref for SmartPathBuf[src]
impl Index<usize> for SmartPathBuf[src]
type Output = OsString
The returned type after indexing.
fn index(&self, idx: usize) -> &Self::Output[src]
impl Index<Range<usize>> for SmartPathBuf[src]
type Output = [OsString]
The returned type after indexing.
fn index(&self, rng: Range<usize>) -> &Self::Output[src]
On unix the / is always the first element in a Path
impl Index<RangeFull> for SmartPathBuf[src]
type Output = [OsString]
The returned type after indexing.
fn index(&self, rng: RangeFull) -> &Self::Output[src]
On unix the / is always the first element in a Path
impl Index<RangeFrom<usize>> for SmartPathBuf[src]
type Output = [OsString]
The returned type after indexing.
fn index(&self, rng: RangeFrom<usize>) -> &Self::Output[src]
On unix the / is always the first element in a Path
impl Index<RangeTo<usize>> for SmartPathBuf[src]
type Output = [OsString]
The returned type after indexing.
fn index(&self, rng: RangeTo<usize>) -> &Self::Output[src]
On unix the / is always the first element in a Path
impl IndexMut<usize> for SmartPathBuf[src]
impl IndexMut<Range<usize>> for SmartPathBuf[src]
impl IndexMut<RangeFull> for SmartPathBuf[src]
impl IndexMut<RangeFrom<usize>> for SmartPathBuf[src]
impl IndexMut<RangeTo<usize>> for SmartPathBuf[src]
impl Borrow<Path> for SmartPathBuf[src]
Auto Trait Implementations
impl Send for SmartPathBuf
impl Sync for SmartPathBuf
impl Unpin for SmartPathBuf
impl UnwindSafe for SmartPathBuf
impl RefUnwindSafe for SmartPathBuf
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,