push: Implement AsRef<str> for PredefinedRuleId
This commit is contained in:
parent
df1a63909a
commit
ba75b09a45
@ -11,6 +11,7 @@ Improvements:
|
||||
- Stabilize support for `.m.rule.suppress_edits` push rule (MSC3958 / Matrix 1.9)
|
||||
- Add `MatrixVersion::V1_9`
|
||||
- Point links to the Matrix 1.9 specification
|
||||
- Implement `as_str()` and `AsRef<str>` for `push::PredefinedRuleId`
|
||||
|
||||
# 0.12.1
|
||||
|
||||
|
@ -555,6 +555,23 @@ pub enum PredefinedRuleId {
|
||||
Content(PredefinedContentRuleId),
|
||||
}
|
||||
|
||||
impl PredefinedRuleId {
|
||||
/// Creates a string slice from this `PredefinedRuleId`.
|
||||
pub fn as_str(&self) -> &str {
|
||||
match self {
|
||||
Self::Override(id) => id.as_str(),
|
||||
Self::Underride(id) => id.as_str(),
|
||||
Self::Content(id) => id.as_str(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for PredefinedRuleId {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
/// The rule IDs of the predefined override server push rules.
|
||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, StringEnum)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user