tuwunel_matrix/event/
type_ext.rs1use ruma::events::{StateEventType, TimelineEventType};
2
3use super::StateKey;
4
5pub trait TypeExt {
7 fn with_state_key(self, state_key: impl Into<StateKey>) -> (StateEventType, StateKey);
12}
13
14impl TypeExt for StateEventType {
15 fn with_state_key(self, state_key: impl Into<StateKey>) -> (StateEventType, StateKey) {
16 (self, state_key.into())
17 }
18}
19
20impl TypeExt for &StateEventType {
21 fn with_state_key(self, state_key: impl Into<StateKey>) -> (StateEventType, StateKey) {
22 (self.clone(), state_key.into())
23 }
24}
25
26impl TypeExt for TimelineEventType {
27 fn with_state_key(self, state_key: impl Into<StateKey>) -> (StateEventType, StateKey) {
28 (self.to_cow_str().into(), state_key.into())
29 }
30}
31
32impl TypeExt for &TimelineEventType {
33 fn with_state_key(self, state_key: impl Into<StateKey>) -> (StateEventType, StateKey) {
34 (self.to_cow_str().into(), state_key.into())
35 }
36}