Trait rust_utils::config::Config
source · [−]pub trait Config: Serialize + Default + for<'de> Deserialize<'de> {
const FILE_NAME: &'static str;
fn get_save_dir() -> String;
fn get_full_path() -> String { ... }
fn load() -> Self { ... }
fn save(&self) -> Result<()> { ... }
}
Expand description
The Config trait allows a type to have an associated toml config file
Requires the Default, Serialize, and Deserialize traits (can be derived) to be implemented
Required Associated Constants
Required Methods
fn get_save_dir() -> String
fn get_save_dir() -> String
Returns the save directory of the config file.
This method must be defined
Provided Methods
fn get_full_path() -> String
fn get_full_path() -> String
Returns the full path of the config file
Load from the config file
Returns the defaults if the file does not exist or is corrupted
Panics if the config directory cannot be created