push: Move RuleKind to ruma-common
This commit is contained in:
		
							parent
							
								
									bf7c504446
								
							
						
					
					
						commit
						cb122e755c
					
				| @ -1,6 +1,7 @@ | |||||||
| //! Endpoints for push notifications.
 | //! Endpoints for push notifications.
 | ||||||
| use std::{error::Error, fmt}; | use std::{error::Error, fmt}; | ||||||
| 
 | 
 | ||||||
|  | pub use ruma_common::push::RuleKind; | ||||||
| use ruma_common::{ | use ruma_common::{ | ||||||
|     push::{ |     push::{ | ||||||
|         Action, ConditionalPushRule, ConditionalPushRuleInit, HttpPusherData, PatternedPushRule, |         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.
 | /// Which kind a pusher is, and the information for that kind.
 | ||||||
| #[derive(Clone, Debug)] | #[derive(Clone, Debug)] | ||||||
| #[non_exhaustive] | #[non_exhaustive] | ||||||
|  | |||||||
| @ -458,6 +458,31 @@ pub enum PushFormat { | |||||||
|     _Custom(PrivOwnedStr), |     _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)] | #[cfg(test)] | ||||||
| mod tests { | mod tests { | ||||||
|     use std::collections::BTreeMap; |     use std::collections::BTreeMap; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user