fix complex types
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
de21f7442a
commit
875d9e8b07
2 changed files with 9 additions and 7 deletions
|
@ -11,6 +11,9 @@ pub(super) struct Data {
|
||||||
softfailedeventids: Arc<dyn KvTree>,
|
softfailedeventids: Arc<dyn KvTree>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PdusIterItem = Result<(PduCount, PduEvent)>;
|
||||||
|
type PdusIterator<'a> = Box<dyn Iterator<Item = PdusIterItem> + 'a>;
|
||||||
|
|
||||||
impl Data {
|
impl Data {
|
||||||
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
|
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -29,7 +32,7 @@ impl Data {
|
||||||
|
|
||||||
pub(super) fn relations_until<'a>(
|
pub(super) fn relations_until<'a>(
|
||||||
&'a self, user_id: &'a UserId, shortroomid: u64, target: u64, until: PduCount,
|
&'a self, user_id: &'a UserId, shortroomid: u64, target: u64, until: PduCount,
|
||||||
) -> Result<Box<dyn Iterator<Item = Result<(PduCount, PduEvent)>> + 'a>> {
|
) -> Result<PdusIterator<'a>> {
|
||||||
let prefix = target.to_be_bytes().to_vec();
|
let prefix = target.to_be_bytes().to_vec();
|
||||||
let mut current = prefix.clone();
|
let mut current = prefix.clone();
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ pub struct Data {
|
||||||
db: Arc<KeyValueDatabase>,
|
db: Arc<KeyValueDatabase>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PdusIterItem = Result<(PduCount, PduEvent)>;
|
||||||
|
type PdusIterator<'a> = Box<dyn Iterator<Item = PdusIterItem> + 'a>;
|
||||||
|
|
||||||
impl Data {
|
impl Data {
|
||||||
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
|
pub(super) fn new(db: &Arc<KeyValueDatabase>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -203,9 +206,7 @@ impl Data {
|
||||||
/// Returns an iterator over all events and their tokens in a room that
|
/// Returns an iterator over all events and their tokens in a room that
|
||||||
/// happened before the event with id `until` in reverse-chronological
|
/// happened before the event with id `until` in reverse-chronological
|
||||||
/// order.
|
/// order.
|
||||||
pub(super) fn pdus_until<'a>(
|
pub(super) fn pdus_until(&self, user_id: &UserId, room_id: &RoomId, until: PduCount) -> Result<PdusIterator<'_>> {
|
||||||
&'a self, user_id: &UserId, room_id: &RoomId, until: PduCount,
|
|
||||||
) -> Result<Box<dyn Iterator<Item = Result<(PduCount, PduEvent)>> + 'a>> {
|
|
||||||
let (prefix, current) = count_to_id(room_id, until, 1, true)?;
|
let (prefix, current) = count_to_id(room_id, until, 1, true)?;
|
||||||
|
|
||||||
let user_id = user_id.to_owned();
|
let user_id = user_id.to_owned();
|
||||||
|
@ -227,9 +228,7 @@ impl Data {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn pdus_after<'a>(
|
pub(super) fn pdus_after(&self, user_id: &UserId, room_id: &RoomId, from: PduCount) -> Result<PdusIterator<'_>> {
|
||||||
&'a self, user_id: &UserId, room_id: &RoomId, from: PduCount,
|
|
||||||
) -> Result<Box<dyn Iterator<Item = Result<(PduCount, PduEvent)>> + 'a>> {
|
|
||||||
let (prefix, current) = count_to_id(room_id, from, 1, false)?;
|
let (prefix, current) = count_to_id(room_id, from, 1, false)?;
|
||||||
|
|
||||||
let user_id = user_id.to_owned();
|
let user_id = user_id.to_owned();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue