Skip to content

Commit f3dde16

Browse files
committed
refactor(redecryptor): Add some type aliases for the event ID/event tuples
1 parent a011c8a commit f3dde16

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/matrix-sdk/src/event_cache/redecryptor.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ use crate::{Room, room::PushContext};
146146
type SessionId<'a> = &'a str;
147147
type OwnedSessionId = String;
148148

149+
type EventIdAndUtd = (OwnedEventId, Raw<AnySyncTimelineEvent>);
150+
type EventIdAndEvent = (OwnedEventId, DecryptedRoomEvent);
151+
type ResolvedUtd = (OwnedEventId, DecryptedRoomEvent, Option<Vec<Action>>);
152+
149153
/// The information sent across the channel to the long-running task requesting
150154
/// that the supplied set of sessions be retried.
151155
#[derive(Debug, Clone)]
@@ -206,7 +210,7 @@ impl EventCache {
206210
&self,
207211
room_id: &RoomId,
208212
session_id: SessionId<'_>,
209-
) -> Result<Vec<(OwnedEventId, Raw<AnySyncTimelineEvent>)>, EventCacheError> {
213+
) -> Result<Vec<EventIdAndUtd>, EventCacheError> {
210214
let filter = |event: TimelineEvent| {
211215
let event_id = event.event_id();
212216

@@ -231,7 +235,7 @@ impl EventCache {
231235
&self,
232236
room_id: &RoomId,
233237
session_id: SessionId<'_>,
234-
) -> Result<Vec<(OwnedEventId, DecryptedRoomEvent)>, EventCacheError> {
238+
) -> Result<Vec<EventIdAndEvent>, EventCacheError> {
235239
let filter = |event: TimelineEvent| {
236240
let event_id = event.event_id();
237241

@@ -264,7 +268,7 @@ impl EventCache {
264268
async fn on_resolved_utds(
265269
&self,
266270
room_id: &RoomId,
267-
events: Vec<(OwnedEventId, DecryptedRoomEvent, Option<Vec<Action>>)>,
271+
events: Vec<ResolvedUtd>,
268272
) -> Result<(), EventCacheError> {
269273
if events.is_empty() {
270274
trace!("No events were redecrypted or updated, nothing to replace");

0 commit comments

Comments
 (0)