diff --git a/crates/ruma-federation-api/src/query/get_profile_information/v1.rs b/crates/ruma-federation-api/src/query/get_profile_information/v1.rs index 9d42fb18..f8f8eb73 100644 --- a/crates/ruma-federation-api/src/query/get_profile_information/v1.rs +++ b/crates/ruma-federation-api/src/query/get_profile_information/v1.rs @@ -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() + } +} diff --git a/crates/ruma-push-gateway-api/src/send_event_notification/v1.rs b/crates/ruma-push-gateway-api/src/send_event_notification/v1.rs index ae1eba32..830afe8e 100644 --- a/crates/ruma-push-gateway-api/src/send_event_notification/v1.rs +++ b/crates/ruma-push-gateway-api/src/send_event_notification/v1.rs @@ -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