Skip to content

Commit 227aa93

Browse files
committed
room edit: don't use async_trait for EventSource either
1 parent 1c32851 commit 227aa93

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/matrix-sdk/src/room/edit.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
//! Facilities to edit existing events.
1616
17+
use std::future::Future;
18+
1719
use matrix_sdk_base::deserialized_responses::SyncTimelineEvent;
1820
use ruma::{
1921
events::{
@@ -88,14 +90,13 @@ impl Room {
8890
}
8991
}
9092

91-
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
92-
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
9393
trait EventSource {
94-
async fn get_event(&self, event_id: &EventId) -> Result<SyncTimelineEvent, EditError>;
94+
fn get_event(
95+
&self,
96+
event_id: &EventId,
97+
) -> impl Future<Output = Result<SyncTimelineEvent, EditError>> + Send;
9598
}
9699

97-
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
98-
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
99100
impl<'a> EventSource for &'a Room {
100101
async fn get_event(&self, event_id: &EventId) -> Result<SyncTimelineEvent, EditError> {
101102
match self.event_cache().await {
@@ -225,8 +226,6 @@ mod tests {
225226
events: BTreeMap<OwnedEventId, SyncTimelineEvent>,
226227
}
227228

228-
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
229-
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
230229
impl EventSource for TestEventCache {
231230
async fn get_event(&self, event_id: &EventId) -> Result<SyncTimelineEvent, EditError> {
232231
Ok(self.events.get(event_id).unwrap().clone())

0 commit comments

Comments
 (0)