tuwunel_core/matrix/event/
state_key.rs1use std::cmp::Ordering;
2
3use ruma::events::StateEventType;
4use smallstr::SmallString;
5
6pub type TypeStateKey = (StateEventType, StateKey);
7pub type StateKey = SmallString<[u8; INLINE_SIZE]>;
8
9const INLINE_SIZE: usize = 48;
10
11#[inline]
12#[must_use]
13pub fn cmp(a: &TypeStateKey, b: &TypeStateKey) -> Ordering { a.0.cmp(&b.0).then(a.1.cmp(&b.1)) }
14
15#[inline]
16#[must_use]
17pub fn rcmp(a: &TypeStateKey, b: &TypeStateKey) -> Ordering { b.0.cmp(&a.0).then(b.1.cmp(&a.1)) }