pub struct UserPreferences {
pub disabled_types: HashSet<String>,
pub muted: bool,
}Expand description
Per-user notification preferences
Fields§
§disabled_types: HashSet<String>Notification types that are explicitly disabled
Any type not in this set is considered enabled (opt-out model).
muted: boolGlobal mute — when true, ALL notifications are suppressed
Implementations§
Source§impl UserPreferences
impl UserPreferences
Sourcepub fn is_type_enabled(&self, notification_type: &str) -> bool
pub fn is_type_enabled(&self, notification_type: &str) -> bool
Check if a notification type is enabled
Sourcepub fn disable_type(&mut self, notification_type: impl Into<String>)
pub fn disable_type(&mut self, notification_type: impl Into<String>)
Disable a notification type
Sourcepub fn enable_type(&mut self, notification_type: &str)
pub fn enable_type(&mut self, notification_type: &str)
Enable a notification type (remove from disabled set)
Trait Implementations§
Source§impl Clone for UserPreferences
impl Clone for UserPreferences
Source§fn clone(&self) -> UserPreferences
fn clone(&self) -> UserPreferences
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UserPreferences
impl Debug for UserPreferences
Source§impl Default for UserPreferences
impl Default for UserPreferences
Source§impl<'de> Deserialize<'de> for UserPreferences
impl<'de> Deserialize<'de> for UserPreferences
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for UserPreferences
impl RefUnwindSafe for UserPreferences
impl Send for UserPreferences
impl Sync for UserPreferences
impl Unpin for UserPreferences
impl UnsafeUnpin for UserPreferences
impl UnwindSafe for UserPreferences
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