Skip to content

Commit 6fb3817

Browse files
committed
room edit: don't use async_trait for EventSource either
1 parent 912cb23 commit 6fb3817

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
//! Facilities to edit existing events.
1616
17-
use matrix_sdk_base::deserialized_responses::SyncTimelineEvent;
17+
use std::future::Future;
18+
19+
use matrix_sdk_base::{deserialized_responses::SyncTimelineEvent, SendOutsideWasm};
1820
use ruma::{
1921
events::{
2022
room::message::{Relation, ReplacementMetadata, RoomMessageEventContentWithoutRelation},
@@ -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>> + SendOutsideWasm;
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)