arc_util::settings

Trait HasSettings

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

Source

const SETTINGS_ID: &'static str

The component’s settings id.

Required Associated Types§

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.

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.

Implementors§

Source§

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

Source§

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

Source§

type Settings = WindowSettings<T>