Struct cachedir::CacheDir
[−]
[src]
pub struct CacheDir { /* fields omitted */ }
This structure holds the PathBuf
returned from CacheDirConfig
.
It derefs to PathBuf
and implements most of the same traits as PathBuf
.
Examples
let cache_dir: CacheDir = CacheDirConfig::new("example").get_cache_dir().unwrap(); fn as_path(path: &Path) {} fn into_path_buf<P: Into<PathBuf>>(path: P) { let _path_buf: PathBuf = path.into(); } fn as_ref<P: AsRef<OsStr>>(path: P) { let _os_str: &OsStr = path.as_ref(); } as_path(cache_dir.as_path()); into_path_buf(cache_dir.clone()); as_ref(cache_dir.clone()); println!("{}", cache_dir.display());
Methods
impl CacheDir
[src]
fn into_path_buf(self) -> PathBuf
let path: PathBuf = CacheDirConfig::new("example") .get_cache_dir().unwrap() .into_path_buf();
Methods from Deref<Target = PathBuf>
fn as_path(&self) -> &Path
1.0.0
Coerces to a Path
slice.
Examples
use std::path::{Path, PathBuf}; let p = PathBuf::from("/test"); assert_eq!(Path::new("/test"), p.as_path());
fn into_os_string(self) -> OsString
1.0.0
Consumes the PathBuf
, yielding its internal OsString
storage.
Examples
use std::path::PathBuf; let p = PathBuf::from("/the/head"); let os_str = p.into_os_string();
fn into_boxed_path(self) -> Box<Path>
into_boxed_path
)Trait Implementations
impl Deref for CacheDir
[src]
type Target = PathBuf
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl Into<PathBuf> for CacheDir
[src]
impl Into<OsString> for CacheDir
[src]
impl Borrow<PathBuf> for CacheDir
[src]
impl Borrow<Path> for CacheDir
[src]
impl Borrow<OsStr> for CacheDir
[src]
impl AsRef<PathBuf> for CacheDir
[src]
impl AsRef<Path> for CacheDir
[src]
impl AsRef<OsStr> for CacheDir
[src]
impl<'a> IntoIterator for &'a CacheDir
[src]
type Item = &'a OsStr
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl Debug for CacheDir
[src]
impl Clone for CacheDir
[src]
fn clone(&self) -> CacheDir
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for CacheDir
[src]
fn eq(&self, __arg_0: &CacheDir) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &CacheDir) -> bool
This method tests for !=
.
impl Eq for CacheDir
[src]
impl Hash for CacheDir
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialOrd for CacheDir
[src]
fn partial_cmp(&self, __arg_0: &CacheDir) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &CacheDir) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &CacheDir) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &CacheDir) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &CacheDir) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more