pub trait AppStrategy {
// Required methods
fn home_dir(&self) -> &Path;
fn config_dir(&self) -> PathBuf;
fn data_dir(&self) -> PathBuf;
fn cache_dir(&self) -> PathBuf;
fn state_dir(&self) -> Option<PathBuf>;
fn runtime_dir(&self) -> Option<PathBuf>;
// Provided methods
fn in_config_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf { ... }
fn in_data_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf { ... }
fn in_cache_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf { ... }
fn in_state_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf> { ... }
fn in_runtime_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf> { ... }
}Expand description
Allows applications to retrieve the paths of configuration, data, and cache directories specifically for them.
Required Methods§
Sourcefn config_dir(&self) -> PathBuf
fn config_dir(&self) -> PathBuf
Gets the configuration directory for your application.
Sourcefn runtime_dir(&self) -> Option<PathBuf>
fn runtime_dir(&self) -> Option<PathBuf>
Gets the runtime directory for your application.
Currently, only the Xdg & Unix strategies support
this.
Note: The XDG Base Directory Specification places additional requirements on this directory related to ownership, permissions, and persistence. This library does not check these requirements.
Provided Methods§
Sourcefn in_config_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
fn in_config_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
Constructs a path inside your application’s configuration directory to which a path of your choice has been appended.
Sourcefn in_data_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
fn in_data_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
Constructs a path inside your application’s data directory to which a path of your choice has been appended.
Sourcefn in_cache_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
fn in_cache_dir<P: AsRef<OsStr>>(&self, path: P) -> PathBuf
Constructs a path inside your application’s cache directory to which a path of your choice has been appended.
Sourcefn in_state_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf>
fn in_state_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf>
Constructs a path inside your application’s state directory to which a path of your choice has been appended.
Currently, this is only implemented for the Xdg strategy.
Sourcefn in_runtime_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf>
fn in_runtime_dir<P: AsRef<OsStr>>(&self, path: P) -> Option<PathBuf>
Constructs a path inside your application’s runtime directory to which a path of your choice has been appended.
Currently, only the Xdg & Unix strategies support
this.
See the note in runtime_dir for more information.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.