macro_rules! register_setting_key {
($vis:vis const $name:ident: $ty:ty = $key:literal) => { ... };
}Expand description
Register a type-safe settings key.
This macro is the primary way to create settings keys. It associates a string key name with a value type at compile time.
Important: The key name must be globally unique across the entire application. Using the same key name for different settings will cause conflicts.
ยงExample
use bitwarden_state::register_setting_key;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct AppConfig {
theme: String,
auto_save: bool,
}
register_setting_key!(pub const CONFIG: AppConfig = "app_config");