Struct cap_directories::ProjectDirs
source · [−]pub struct ProjectDirs { /* private fields */ }
Expand description
ProjectDirs
computes the cache, config or data directories for a specific
application, which are derived from the standard directories and the name
of the project/organization.
This corresponds to directories_next::ProjectDirs
, except that the
functions create the directories if they don’t exist, open them, and return
Dir
s instead of returning Path
s.
Unlike directories_next::ProjectDirs
, this API has no
ProjectDirs::from_path
, ProjectDirs::path
or
ProjectDirs::project_path
, and the *_dir
functions return Dir
s rather
than Path
s, because absolute paths don’t interoperate well with the
capability model.
Implementations
sourceimpl ProjectDirs
impl ProjectDirs
sourcepub fn from(
qualifier: &str,
organization: &str,
application: &str,
_: AmbientAuthority
) -> Option<Self>
pub fn from(
qualifier: &str,
organization: &str,
application: &str,
_: AmbientAuthority
) -> Option<Self>
Creates a ProjectDirs
struct from values describing the project.
This corresponds to directories_next::ProjectDirs::from
.
Ambient Authority
This function makes use of ambient authority to access the project directories.
sourcepub fn cache_dir(&self) -> Result<Dir>
pub fn cache_dir(&self) -> Result<Dir>
Returns the project’s cache directory.
This corresponds to directories_next::ProjectDirs::cache_dir
.
sourcepub fn config_dir(&self) -> Result<Dir>
pub fn config_dir(&self) -> Result<Dir>
Returns the project’s config directory.
This corresponds to directories_next::ProjectDirs::config_dir
.
sourcepub fn data_dir(&self) -> Result<Dir>
pub fn data_dir(&self) -> Result<Dir>
Returns the project’s data directory.
This corresponds to directories_next::ProjectDirs::data_dir
.
sourcepub fn data_local_dir(&self) -> Result<Dir>
pub fn data_local_dir(&self) -> Result<Dir>
Returns the project’s local data directory.
This corresponds to directories_next::ProjectDirs::data_local_dir
.
sourcepub fn runtime_dir(&self) -> Result<Dir>
pub fn runtime_dir(&self) -> Result<Dir>
Returns the project’s runtime directory.
This corresponds to directories_next::ProjectDirs::runtime_dir
.
Trait Implementations
sourceimpl Clone for ProjectDirs
impl Clone for ProjectDirs
sourcefn clone(&self) -> ProjectDirs
fn clone(&self) -> ProjectDirs
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for ProjectDirs
impl Send for ProjectDirs
impl Sync for ProjectDirs
impl Unpin for ProjectDirs
impl UnwindSafe for ProjectDirs
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more