pub trait SettingsGroup: Resource {
// Required methods
fn settings_group_name() -> &'static str;
fn settings_key_name() -> Option<&'static str>;
fn settings_source() -> Option<&'static str>;
}Expand description
Trait which identifies a type as corresponding to a section with a settings file.
You can override the name of the section with settings_group(group = "<name>").
For enum SettingGroups, you can also override the name of its key with settings_group(key = "<name>")
The name should be in snake_case to be consistent with TOML style.
If there is a collision between names (multiple resources have the same name) then
the resulting properties will be merged into a single section.
You can also control which file the type gets saved to via
settings_group(file = "<filename>"). This should be the base name of the file without the
extension. The default name is settings, which will cause the settings to be written out
to settings.toml in the app’s settings directory.
Required Methods§
Sourcefn settings_group_name() -> &'static str
fn settings_group_name() -> &'static str
The name of the logical section within the settings file.
Sourcefn settings_key_name() -> Option<&'static str>
fn settings_key_name() -> Option<&'static str>
The key name within the settings file.
For structs, this should be set to None; The struct’s field names will be used as keys.
For enums, the SettingsGroup will use this key name within the settings file for its sole key-value pair.
This is typically the same as the group name, but can be customized.
Sourcefn settings_source() -> Option<&'static str>
fn settings_source() -> Option<&'static str>
The name of the configuration file that contains this settings group.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".