Skip to main content

SettingsModel

Trait SettingsModel 

Source
pub trait SettingsModel:
    Serialize
    + DeserializeOwned
    + Default {
    const CODE: &'static str;
}
Expand description

A settings model: a serde struct with a stable storage code and a default.

Give fields #[serde(default)] so a stored value missing a field (an older save, or a newly added field) deserializes cleanly.

Required Associated Constants§

Source

const CODE: &'static str

The stable storage key. Never change it once shipped.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§