pub struct NotificationPreferencesStore { /* private fields */ }Expand description
In-memory notification preferences store
Thread-safe store mapping user IDs to their notification preferences.
Implementations§
Source§impl NotificationPreferencesStore
impl NotificationPreferencesStore
Sourcepub async fn get(&self, user_id: &str) -> UserPreferences
pub async fn get(&self, user_id: &str) -> UserPreferences
Get preferences for a user (returns defaults if not set)
Sourcepub async fn update(&self, user_id: impl Into<String>, prefs: UserPreferences)
pub async fn update(&self, user_id: impl Into<String>, prefs: UserPreferences)
Update preferences for a user
Sourcepub async fn is_enabled(&self, user_id: &str, notification_type: &str) -> bool
pub async fn is_enabled(&self, user_id: &str, notification_type: &str) -> bool
Check if a notification type is enabled for a user
Convenience method that combines get + is_type_enabled. Returns true if the user has no preferences set (default = all enabled).
Sourcepub async fn disable_type(&self, user_id: &str, notification_type: &str)
pub async fn disable_type(&self, user_id: &str, notification_type: &str)
Disable a specific notification type for a user
Sourcepub async fn enable_type(&self, user_id: &str, notification_type: &str)
pub async fn enable_type(&self, user_id: &str, notification_type: &str)
Enable a specific notification type for a user
Trait Implementations§
Source§impl Debug for NotificationPreferencesStore
impl Debug for NotificationPreferencesStore
Auto Trait Implementations§
impl !Freeze for NotificationPreferencesStore
impl !RefUnwindSafe for NotificationPreferencesStore
impl Send for NotificationPreferencesStore
impl Sync for NotificationPreferencesStore
impl Unpin for NotificationPreferencesStore
impl UnsafeUnpin for NotificationPreferencesStore
impl !UnwindSafe for NotificationPreferencesStore
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