From d8d9d2030d6c921b54555e1b67e7bd36b9472c63 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 21 Sep 2024 00:46:57 +0000 Subject: [PATCH] Make state_res interface iterators +Send Signed-off-by: Jason Volk --- crates/ruma-state-res/src/state_event.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ruma-state-res/src/state_event.rs b/crates/ruma-state-res/src/state_event.rs index 93489d28..df2c919b 100644 --- a/crates/ruma-state-res/src/state_event.rs +++ b/crates/ruma-state-res/src/state_event.rs @@ -11,7 +11,7 @@ use serde_json::value::RawValue as RawJsonValue; /// Abstraction of a PDU so users can have their own PDU types. pub trait Event { - type Id: Clone + Debug + Display + Eq + Ord + Hash + Borrow; + type Id: Clone + Debug + Display + Eq + Ord + Hash + Send + Borrow; /// The `EventId` of this event. fn event_id(&self) -> &Self::Id; @@ -36,11 +36,11 @@ pub trait Event { /// The events before this event. // Requires GATs to avoid boxing (and TAIT for making it convenient). - fn prev_events(&self) -> Box + '_>; + fn prev_events(&self) -> impl DoubleEndedIterator + Send + '_; /// All the authenticating events for this event. // Requires GATs to avoid boxing (and TAIT for making it convenient). - fn auth_events(&self) -> Box + '_>; + fn auth_events(&self) -> impl DoubleEndedIterator + Send + '_; /// If this event is a redaction event this is the event it redacts. fn redacts(&self) -> Option<&Self::Id>; @@ -77,11 +77,11 @@ impl Event for &T { (*self).state_key() } - fn prev_events(&self) -> Box + '_> { + fn prev_events(&self) -> impl DoubleEndedIterator + Send + '_ { (*self).prev_events() } - fn auth_events(&self) -> Box + '_> { + fn auth_events(&self) -> impl DoubleEndedIterator + Send + '_ { (*self).auth_events() } @@ -121,11 +121,11 @@ impl Event for Arc { (**self).state_key() } - fn prev_events(&self) -> Box + '_> { + fn prev_events(&self) -> impl DoubleEndedIterator + Send + '_ { (**self).prev_events() } - fn auth_events(&self) -> Box + '_> { + fn auth_events(&self) -> impl DoubleEndedIterator + Send + '_ { (**self).auth_events() }