Struct unidirs::LocalDirs [−][src]
pub struct LocalDirs { /* fields omitted */ }
Expand description
Local directories are meant mostly for debug purposes while developing an application. By
default it provides all available directories in under a .local
folder in the current working
directory.
An alternative base directory can be provided with the LocalDirs::new_at
function.
The folders are defined as follows, with <base>
being either .local
or a user defined
directory:
Type | Location |
---|---|
Cache | <base> /cache |
Config | <base> /config |
Data | <base> /data |
Implementations
Create a default instance, using the $PWD/.local
directory as a base.
Examples
use std::env;
use unidirs::{Directories, LocalDirs};
let dirs = LocalDirs::new().unwrap();
assert_eq!(env::current_dir().unwrap().join(".local/data"), dirs.data_dir());
Create an instance at the given base directory.
Examples
use tempfile::TempDir;
use unidirs::{Directories, LocalDirs, Utf8Path};
let temp = TempDir::new().unwrap();
let dirs = LocalDirs::new_at(Utf8Path::from_path(temp.path()).unwrap());
assert_eq!(temp.path().join("data"), dirs.data_dir());
Trait Implementations
The cache directory is a location where an application can save any temporary data. The contents can potentially be deleted by the system at any time. Therefore, the application must be able to work without these files or be able to re-create them. Read more
The config directory is where an application’s settings are stored. These are usually created by the user and loaded once at startup of the application. Read more
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
Auto Trait Implementations
impl RefUnwindSafe for LocalDirs
impl UnwindSafe for LocalDirs
Blanket Implementations
Mutably borrows from an owned value. Read more