pub struct Key<T> { /* private fields */ }Expand description
Type-safe key for settings storage.
Associates a string key name with a value type at compile time, preventing type mismatches while maintaining ergonomic usage.
Use the register_setting_key! macro to create keys.
§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");Trait Implementations§
impl<T: Copy> Copy for Key<T>
Auto Trait Implementations§
impl<T> Freeze for Key<T>
impl<T> RefUnwindSafe for Key<T>where
T: RefUnwindSafe,
impl<T> Send for Key<T>where
T: Send,
impl<T> Sync for Key<T>where
T: Sync,
impl<T> Unpin for Key<T>where
T: Unpin,
impl<T> UnsafeUnpin for Key<T>
impl<T> UnwindSafe for Key<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more