push: Move RuleKind to ruma-common

This commit is contained in:
Kévin Commaille 2022-10-31 09:56:18 +01:00 committed by Kévin Commaille
parent bf7c504446
commit cb122e755c
2 changed files with 26 additions and 25 deletions

View File

@ -1,6 +1,7 @@
//! Endpoints for push notifications.
use std::{error::Error, fmt};
pub use ruma_common::push::RuleKind;
use ruma_common::{
push::{
Action, ConditionalPushRule, ConditionalPushRuleInit, HttpPusherData, PatternedPushRule,
@ -165,31 +166,6 @@ impl TryFrom<PushRule> for ConditionalPushRule {
}
}
/// The kinds of push rules that are available.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, StringEnum)]
#[ruma_enum(rename_all = "snake_case")]
#[non_exhaustive]
pub enum RuleKind {
/// User-configured rules that override all other kinds.
Override,
/// Lowest priority user-defined rules.
Underride,
/// Sender-specific rules.
Sender,
/// Room-specific rules.
Room,
/// Content-specific rules.
Content,
#[doc(hidden)]
_Custom(PrivOwnedStr),
}
/// Which kind a pusher is, and the information for that kind.
#[derive(Clone, Debug)]
#[non_exhaustive]

View File

@ -458,6 +458,31 @@ pub enum PushFormat {
_Custom(PrivOwnedStr),
}
/// The kinds of push rules that are available.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, StringEnum)]
#[ruma_enum(rename_all = "snake_case")]
#[non_exhaustive]
pub enum RuleKind {
/// User-configured rules that override all other kinds.
Override,
/// Lowest priority user-defined rules.
Underride,
/// Sender-specific rules.
Sender,
/// Room-specific rules.
Room,
/// Content-specific rules.
Content,
#[doc(hidden)]
_Custom(PrivOwnedStr),
}
#[cfg(test)]
mod tests {
use std::collections::BTreeMap;