federation/push: Make all pub enums non_exhaustive
This commit is contained in:
parent
c55dab7122
commit
1489b5e1f1
@ -69,7 +69,11 @@ impl Response {
|
||||
}
|
||||
|
||||
/// Profile fields to specify in query.
|
||||
///
|
||||
/// This type can hold an arbitrary string. To check for formats that are not available as a
|
||||
/// documented variant here, use its string representation, obtained through `.as_str()`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
|
||||
#[non_exhaustive]
|
||||
pub enum ProfileField {
|
||||
/// Display name of the user.
|
||||
#[ruma_enum(rename = "displayname")]
|
||||
@ -82,3 +86,10 @@ pub enum ProfileField {
|
||||
#[doc(hidden)]
|
||||
_Custom(String),
|
||||
}
|
||||
|
||||
impl ProfileField {
|
||||
/// Creates a string slice from this `ProfileField`.
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.as_ref()
|
||||
}
|
||||
}
|
||||
|
@ -136,8 +136,12 @@ impl<'a> Notification<'a> {
|
||||
///
|
||||
/// This may be used by push gateways to deliver less time-sensitive
|
||||
/// notifications in a way that will preserve battery power on mobile devices.
|
||||
///
|
||||
/// This type can hold an arbitrary string. To check for formats that are not available as a
|
||||
/// documented variant here, use its string representation, obtained through `.as_str()`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
|
||||
#[ruma_enum(rename_all = "snake_case")]
|
||||
#[non_exhaustive]
|
||||
pub enum NotificationPriority {
|
||||
/// A high priority notification
|
||||
High,
|
||||
@ -149,6 +153,13 @@ pub enum NotificationPriority {
|
||||
_Custom(String),
|
||||
}
|
||||
|
||||
impl NotificationPriority {
|
||||
/// Creates a string slice from this `NotificationPriority`.
|
||||
pub fn as_str(&self) -> &str {
|
||||
self.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for NotificationPriority {
|
||||
fn default() -> Self {
|
||||
Self::High
|
||||
|
Loading…
x
Reference in New Issue
Block a user