storage
struct Settings
pub struct SettingsStorage-related configuration settings.
Controls where gest persists data on disk. The [storage] TOML table maps to this struct.
| Field | Type | Description |
|---|---|---|
cache_dir |
Option<PathBuf> | Explicit cache directory override from the config file. |
data_dir |
Option<PathBuf> | Explicit data directory override from the config file. |
sync |
Option<bool> | Whether automatic file sync with .gest/ directories is enabled. Defaults to true when absent. |
Implements Clone, Debug, Default, Deserialize<'de>, PartialEq, Serialize.
Settings::cache_dir
pub fn cache_dir(&self) -> Result<PathBuf, Error>Resolves the cache directory using the following precedence:
GEST_STORAGE__CACHE_DIRenvironment variable (must be absolute)storage.cache_dirfrom the config file (must be absolute)- XDG cache home (
$XDG_CACHE_HOME/gest), falling back to~/.cache/gestwhenXDG_CACHE_HOMEis unset (handled bydir_spec::cache_home).
The cache directory holds regeneratable artifacts (such as the avatar cache) that gest owns internally. Users control only the root; layout beneath it is an implementation detail.
| Parameter | Type | Description |
|---|---|---|
| returns | Result<PathBuf, Error> | The cache directory, or Error::XDGDirNotFound when no override applies and the XDG cache directory cannot be resolved. |
Settings::data_dir
pub fn data_dir(&self) -> Result<PathBuf, Error>Resolves the data directory using the following precedence:
GEST_STORAGE__DATA_DIRenvironment variable (must be absolute)storage.data_dirfrom the config file (must be absolute)- XDG data home (
$XDG_DATA_HOME/gest)
| Parameter | Type | Description |
|---|---|---|
| returns | Result<PathBuf, Error> | The data directory, or Error::XDGDirNotFound when no override applies and the XDG data directory cannot be resolved. |
Settings::data_dir_override
pub fn data_dir_override(&self) -> Option<PathBuf>Resolve only an explicit data-dir override, without falling back to XDG.
Returns None when neither environment nor config supplies a usable
absolute data directory. This lets startup distinguish “user explicitly
asked for this database root” from the default global fallback.
| Parameter | Type | Description |
|---|---|---|
| returns | Option<PathBuf> | The absolute override from the environment or the config file. |
Settings::sync_enabled
pub fn sync_enabled(&self) -> boolWhether automatic file sync with .gest/ directories is enabled.
Precedence:
GEST_STORAGE__SYNCenvironment variable (boolean)storage.syncfrom the config file- Defaults to
true
| Parameter | Type | Description |
|---|---|---|
| returns | bool | The first value set, in the order above. |