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 Types§

Required Associated Constants§

source

const SETTINGS_ID: &'static str

The component’s settings id.

Required Methods§

source

fn current_settings(&self) -> Self::Settings

Returns the component’s current settings state.

source

fn load_settings(&mut self, loaded: Self::Settings)

Loads the component’s settings from a loaded state.

Provided Methods§

source

fn reset_settings(&mut self)
where Self::Settings: Default,

Resets the component’s settings to the defaults.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> HasSettings for Window<T>
where T: HasSettings,

§

type Settings = WindowSettings<T>

source§

const SETTINGS_ID: &'static str = T::SETTINGS_ID