pub struct UserDirs { /* private fields */ }
Expand description
User directories are used when applications are directly run by local regular users. The folder locations vary greatly by platform, as each has their own rules about where to put them.
Linux
On Linux systems the folders are usually located in the home folder, but may be overridden by the common XDG user directory environment variables.
Type | Location |
---|---|
Cache | $XDG_CACHE_HOME /<app> or $HOME /.cache/<app> |
Config | $XDG_CONFIG_HOME /<app> or $HOME /.config/<app> |
Data | $XDG_DATA_HOME /<app> or $HOME /.local/share/<app> |
Mac OS
Type | Location |
---|---|
Cache | $HOME /Library/Caches/<qual> .<org> .<app> |
Config | $HOME /Library/Application Support/<qual> .<org> .<app> |
Data | $HOME /Library/Application Support/<qual> .<org> .<app> |
Windows
Type | Location |
---|---|
Cache | %LOCALAPPDATA% \<org> \<app> \cache |
Config | %ROAMINGAPPDATA% \<org> \<app> \config |
Data | %ROAMINGAPPDATA% \<org> \<app> \data |
Implementations§
source§impl UserDirs
impl UserDirs
sourcepub fn new(
qualifier: impl AsRef<str>,
organization: impl AsRef<str>,
application: impl AsRef<str>
) -> Option<Self>
pub fn new( qualifier: impl AsRef<str>, organization: impl AsRef<str>, application: impl AsRef<str> ) -> Option<Self>
Create a new instance with the given qualifier, organization and application. These values are used to create a custom directory structure depending on the operating system standards.
Trait Implementations§
source§impl Directories for UserDirs
impl Directories for UserDirs
source§fn cache_dir(&self) -> &Utf8Path
fn cache_dir(&self) -> &Utf8Path
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.
source§fn config_dir(&self) -> &Utf8Path
fn config_dir(&self) -> &Utf8Path
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.
source§impl Ord for UserDirs
impl Ord for UserDirs
source§impl PartialEq<UserDirs> for UserDirs
impl PartialEq<UserDirs> for UserDirs
source§impl PartialOrd<UserDirs> for UserDirs
impl PartialOrd<UserDirs> for UserDirs
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more