Trait rust_utils::config::Config
source · pub trait Config: Serialize + Default + for<'de> Deserialize<'de> {
const FILE_NAME: &'static str;
const TYPE: ConfigType = ConfigType::Toml;
// Required method
fn get_save_dir() -> String;
// Provided methods
fn get_full_path() -> String { ... }
fn load() -> Self { ... }
fn save(&self) -> IoResult<()> { ... }
}
Expand description
The Config
trait allows a type to have an associated config file
Requires the Default
, Serialize
, and Deserialize
traits (can be derived) to be implemented
Required Associated Constants§
Provided Associated Constants§
sourceconst TYPE: ConfigType = ConfigType::Toml
const TYPE: ConfigType = ConfigType::Toml
This constant is the type of config
Defaults to TOML
Required Methods§
sourcefn get_save_dir() -> String
fn get_save_dir() -> String
Returns the save directory of the config file.
This method must be defined
Provided Methods§
sourcefn get_full_path() -> String
fn get_full_path() -> String
Returns the full path of the config file
Object Safety§
This trait is not object safe.