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]

let path: PathBuf = CacheDirConfig::new("example")
                                   .get_cache_dir().unwrap()
                                   .into_path_buf();

Methods from Deref<Target = PathBuf>

Coerces to a Path slice.

Examples

use std::path::{Path, PathBuf};

let p = PathBuf::from("/test");
assert_eq!(Path::new("/test"), p.as_path());

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();

🔬 This is a nightly-only experimental API. (into_boxed_path)

Converts this PathBuf into a boxed Path.

Trait Implementations

impl Deref for CacheDir
[src]

The resulting type after dereferencing

The method called to dereference a value

impl Into<PathBuf> for CacheDir
[src]

Performs the conversion.

impl Into<OsString> for CacheDir
[src]

Performs the conversion.

impl Borrow<PathBuf> for CacheDir
[src]

Immutably borrows from an owned value. Read more

impl Borrow<Path> for CacheDir
[src]

Immutably borrows from an owned value. Read more

impl Borrow<OsStr> for CacheDir
[src]

Immutably borrows from an owned value. Read more

impl AsRef<PathBuf> for CacheDir
[src]

Performs the conversion.

impl AsRef<Path> for CacheDir
[src]

Performs the conversion.

impl AsRef<OsStr> for CacheDir
[src]

Performs the conversion.

impl<'a> IntoIterator for &'a CacheDir
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl Debug for CacheDir
[src]

Formats the value using the given formatter.

impl Clone for CacheDir
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for CacheDir
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for CacheDir
[src]

impl Hash for CacheDir
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl PartialOrd for CacheDir
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for CacheDir
[src]

This method returns an Ordering between self and other. Read more