pub trait HasSettings {
type Settings: Serialize + DeserializeOwned;
const SETTINGS_ID: &'static str;
// Required methods
fn current_settings(&self) -> Self::Settings;
fn load_settings(&mut self, loaded: Self::Settings);
// Provided method
fn reset_settings(&mut self)
where Self::Settings: Default { ... }
}
Expand description
Interface for components with settings.
Required Associated Constants§
Sourceconst SETTINGS_ID: &'static str
const SETTINGS_ID: &'static str
The component’s settings id.
Required Associated Types§
type Settings: Serialize + DeserializeOwned
Required Methods§
Sourcefn current_settings(&self) -> Self::Settings
fn current_settings(&self) -> Self::Settings
Returns the component’s current settings state.
Sourcefn load_settings(&mut self, loaded: Self::Settings)
fn load_settings(&mut self, loaded: Self::Settings)
Loads the component’s settings from a loaded state.
Provided Methods§
Sourcefn reset_settings(&mut self)
fn reset_settings(&mut self)
Resets the component’s settings to the defaults.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.