pub struct ConfigManager<T> { /* private fields */ }Implementations§
Source§impl<T> ConfigManager<T>where
T: Serialize + DeserializeOwned,
impl<T> ConfigManager<T>where
T: Serialize + DeserializeOwned,
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a config manager using the OS standard config directory and current executable name.
On Windows desktop apps this resolves under %APPDATA%.
Pure UWP apps should use with_root_dir or the optional uwp feature instead.
Sourcepub fn at_current_dir(self) -> Self
pub fn at_current_dir(self) -> Self
Stores the settings file in the current working directory.
Sourcepub fn with_root_dir<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_root_dir<P: Into<PathBuf>>(self, path: P) -> Self
Stores the settings file in a caller-provided directory.
This is the primary compatibility seam for sandboxed hosts, including Pure UWP. The host application may resolve its application data directory and pass it here.
Sourcepub fn at_custom_dir<P: Into<PathBuf>>(self, path: P) -> Self
pub fn at_custom_dir<P: Into<PathBuf>>(self, path: P) -> Self
Stores the settings file in a caller-provided directory.
This method is kept for compatibility with v2.0.x. Prefer with_root_dir in new code.
Sourcepub fn with_filename(self, name: &str) -> Self
pub fn with_filename(self, name: &str) -> Self
Changes the settings file name.
Sourcepub fn disable_pretty_json(self) -> Self
pub fn disable_pretty_json(self) -> Self
Stores JSON in compact form instead of pretty-printed form.
Sourcepub fn folder_path(&self) -> &Path
pub fn folder_path(&self) -> &Path
Returns the settings folder path.