pub trait StoragePath {
// Required methods
fn storage_file_name() -> &'static str;
fn storage_dir_name() -> &'static str;
// Provided methods
fn base_dir_path() -> PathBuf { ... }
fn get_or_create_storage_path() -> Result<PathBuf, Error> { ... }
fn get_or_create_storage_file_path() -> Result<PathBuf, Error> { ... }
}
Expand description
Trait for types that can be stored.
Contains logic to create or get the path to the storage file and storage dir.
Required Methods§
Sourcefn storage_file_name() -> &'static str
fn storage_file_name() -> &'static str
The name of the storage file.
Sourcefn storage_dir_name() -> &'static str
fn storage_dir_name() -> &'static str
The name of the storage directory.
Provided Methods§
Sourcefn base_dir_path() -> PathBuf
fn base_dir_path() -> PathBuf
The base directory path.
Sourcefn get_or_create_storage_path() -> Result<PathBuf, Error>
fn get_or_create_storage_path() -> Result<PathBuf, Error>
Gets or creates the storage directory.
If its creation fails. an ErrorKind::Unsupported
error is returned.
Sourcefn get_or_create_storage_file_path() -> Result<PathBuf, Error>
fn get_or_create_storage_file_path() -> Result<PathBuf, Error>
Gets or creates the storage file path.
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.