Add depth getter to StateEvent
This commit is contained in:
parent
bafc2016c6
commit
4e9b428c0d
@ -1,5 +1,6 @@
|
||||
use std::{collections::BTreeMap, convert::TryFrom};
|
||||
|
||||
use js_int::UInt;
|
||||
use ruma::{
|
||||
events::{
|
||||
from_raw_json_value,
|
||||
@ -298,6 +299,19 @@ impl StateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn depth(&self) -> &UInt {
|
||||
match self {
|
||||
Self::Full(ev) => match ev {
|
||||
Pdu::RoomV1Pdu(ev) => &ev.depth,
|
||||
Pdu::RoomV3Pdu(ev) => &ev.depth,
|
||||
},
|
||||
Self::Sync(ev) => match ev {
|
||||
PduStub::RoomV1PduStub(ev) => &ev.depth,
|
||||
PduStub::RoomV3PduStub(ev) => &ev.depth,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_type_and_key(&self, ev_type: EventType, state_key: &str) -> bool {
|
||||
match self {
|
||||
Self::Full(ev) => match ev {
|
||||
|
Loading…
x
Reference in New Issue
Block a user