events: Add type accessors to Any{Sync}TimelineEvent
This commit is contained in:
parent
ca78825e94
commit
2934325486
@ -180,6 +180,14 @@ impl AnyTimelineEvent {
|
||||
/// Returns this event's `relations` from inside `unsigned`.
|
||||
pub fn relations(&self) -> &BundledRelations;
|
||||
}
|
||||
|
||||
/// Returns this event's `type`.
|
||||
pub fn event_type(&self) -> TimelineEventType {
|
||||
match self {
|
||||
Self::MessageLike(e) => e.event_type().into(),
|
||||
Self::State(e) => e.event_type().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Any sync room event.
|
||||
@ -213,6 +221,14 @@ impl AnySyncTimelineEvent {
|
||||
pub fn relations(&self) -> &BundledRelations;
|
||||
}
|
||||
|
||||
/// Returns this event's `type`.
|
||||
pub fn event_type(&self) -> TimelineEventType {
|
||||
match self {
|
||||
Self::MessageLike(e) => e.event_type().into(),
|
||||
Self::State(e) => e.event_type().into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Converts `self` to an `AnyTimelineEvent` by adding the given a room ID.
|
||||
pub fn into_full_event(self, room_id: OwnedRoomId) -> AnyTimelineEvent {
|
||||
match self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user