From 875d9e8b07dd82b9fd9e6243c9529b7d210feff4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 28 Jun 2024 23:05:45 +0000 Subject: [PATCH] fix complex types Signed-off-by: Jason Volk --- src/service/rooms/pdu_metadata/data.rs | 5 ++++- src/service/rooms/timeline/data.rs | 11 +++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/service/rooms/pdu_metadata/data.rs b/src/service/rooms/pdu_metadata/data.rs index e652c9fe..7be183a0 100644 --- a/src/service/rooms/pdu_metadata/data.rs +++ b/src/service/rooms/pdu_metadata/data.rs @@ -11,6 +11,9 @@ pub(super) struct Data { softfailedeventids: Arc, } +type PdusIterItem = Result<(PduCount, PduEvent)>; +type PdusIterator<'a> = Box + 'a>; + impl Data { pub(super) fn new(db: &Arc) -> Self { Self { @@ -29,7 +32,7 @@ impl Data { pub(super) fn relations_until<'a>( &'a self, user_id: &'a UserId, shortroomid: u64, target: u64, until: PduCount, - ) -> Result> + 'a>> { + ) -> Result> { let prefix = target.to_be_bytes().to_vec(); let mut current = prefix.clone(); diff --git a/src/service/rooms/timeline/data.rs b/src/service/rooms/timeline/data.rs index 8264b6f3..41a58f67 100644 --- a/src/service/rooms/timeline/data.rs +++ b/src/service/rooms/timeline/data.rs @@ -16,6 +16,9 @@ pub struct Data { db: Arc, } +type PdusIterItem = Result<(PduCount, PduEvent)>; +type PdusIterator<'a> = Box + 'a>; + impl Data { pub(super) fn new(db: &Arc) -> Self { Self { @@ -203,9 +206,7 @@ impl Data { /// Returns an iterator over all events and their tokens in a room that /// happened before the event with id `until` in reverse-chronological /// order. - pub(super) fn pdus_until<'a>( - &'a self, user_id: &UserId, room_id: &RoomId, until: PduCount, - ) -> Result> + 'a>> { + pub(super) fn pdus_until(&self, user_id: &UserId, room_id: &RoomId, until: PduCount) -> Result> { let (prefix, current) = count_to_id(room_id, until, 1, true)?; let user_id = user_id.to_owned(); @@ -227,9 +228,7 @@ impl Data { )) } - pub(super) fn pdus_after<'a>( - &'a self, user_id: &UserId, room_id: &RoomId, from: PduCount, - ) -> Result> + 'a>> { + pub(super) fn pdus_after(&self, user_id: &UserId, room_id: &RoomId, from: PduCount) -> Result> { let (prefix, current) = count_to_id(room_id, from, 1, false)?; let user_id = user_id.to_owned();