From 88ba0301903d2345b8855386277083d2803d6f9a Mon Sep 17 00:00:00 2001 From: Daniel Salinas Date: Sun, 13 Oct 2024 10:20:47 -0400 Subject: [PATCH] Restore some marker traits that were needed still --- .../matrix-sdk-base/src/event_cache_store/traits.rs | 3 ++- crates/matrix-sdk-base/src/read_receipts.rs | 13 ++----------- crates/matrix-sdk-base/src/store/memory_store.rs | 3 ++- crates/matrix-sdk-base/src/store/traits.rs | 9 ++++++--- crates/matrix-sdk-crypto/src/store/memorystore.rs | 3 ++- crates/matrix-sdk-crypto/src/store/traits.rs | 9 ++++++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/crates/matrix-sdk-base/src/event_cache_store/traits.rs b/crates/matrix-sdk-base/src/event_cache_store/traits.rs index f7cb15ec492..345c2369325 100644 --- a/crates/matrix-sdk-base/src/event_cache_store/traits.rs +++ b/crates/matrix-sdk-base/src/event_cache_store/traits.rs @@ -14,6 +14,7 @@ use std::{fmt, sync::Arc}; +use matrix_sdk_common::AsyncTraitDeps; use async_trait::async_trait; use ruma::MxcUri; @@ -24,7 +25,7 @@ use crate::media::MediaRequest; /// for the event cache of the SDK. #[cfg_attr(target_arch = "wasm32", async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait)] -pub trait EventCacheStore: Send + Sync { +pub trait EventCacheStore: AsyncTraitDeps { /// The error type used by this event cache store. type Error: fmt::Debug + Into; diff --git a/crates/matrix-sdk-base/src/read_receipts.rs b/crates/matrix-sdk-base/src/read_receipts.rs index 7fd14721b63..e02da5b0b9d 100644 --- a/crates/matrix-sdk-base/src/read_receipts.rs +++ b/crates/matrix-sdk-base/src/read_receipts.rs @@ -123,7 +123,7 @@ use std::{ }; use eyeball_im::Vector; -use matrix_sdk_common::{deserialized_responses::SyncTimelineEvent, ring_buffer::RingBuffer}; +use matrix_sdk_common::{deserialized_responses::SyncTimelineEvent, ring_buffer::RingBuffer, SendOutsideWasm, SyncOutsideWasm}; use ruma::{ events::{ poll::{start::PollStartEventContent, unstable_start::UnstablePollStartEventContent}, @@ -266,16 +266,7 @@ impl RoomReadReceipts { } /// Provider for timeline events prior to the current sync. -#[cfg(not(target_arch = "wasm32"))] -pub trait PreviousEventsProvider: Send + Sync { - /// Returns the list of known timeline events, in sync order, for the given - /// room. - fn for_room(&self, room_id: &RoomId) -> Vector; -} - -/// Provider for timeline events prior to the current sync. -#[cfg(target_arch = "wasm32")] -pub trait PreviousEventsProvider { +pub trait PreviousEventsProvider: SendOutsideWasm + SyncOutsideWasm { /// Returns the list of known timeline events, in sync order, for the given /// room. fn for_room(&self, room_id: &RoomId) -> Vector; diff --git a/crates/matrix-sdk-base/src/store/memory_store.rs b/crates/matrix-sdk-base/src/store/memory_store.rs index babfc885473..995c7113870 100644 --- a/crates/matrix-sdk-base/src/store/memory_store.rs +++ b/crates/matrix-sdk-base/src/store/memory_store.rs @@ -137,7 +137,8 @@ impl MemoryStore { } } -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl StateStore for MemoryStore { type Error = StoreError; diff --git a/crates/matrix-sdk-base/src/store/traits.rs b/crates/matrix-sdk-base/src/store/traits.rs index cd7cceb2413..d96e3f24cb0 100644 --- a/crates/matrix-sdk-base/src/store/traits.rs +++ b/crates/matrix-sdk-base/src/store/traits.rs @@ -23,6 +23,7 @@ use std::{ use as_variant::as_variant; use async_trait::async_trait; use growable_bloom_filter::GrowableBloom; +use matrix_sdk_common::AsyncTraitDeps; use ruma::{ api::MatrixVersion, events::{ @@ -49,8 +50,9 @@ use crate::{ /// An abstract state store trait that can be used to implement different stores /// for the SDK. -#[async_trait] -pub trait StateStore: fmt::Debug + Send + Sync { +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +pub trait StateStore: AsyncTraitDeps { /// The error type used by this state store. type Error: fmt::Debug + Into + From; @@ -450,7 +452,8 @@ impl fmt::Debug for EraseStateStoreError { } } -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl StateStore for EraseStateStoreError { type Error = StoreError; diff --git a/crates/matrix-sdk-crypto/src/store/memorystore.rs b/crates/matrix-sdk-crypto/src/store/memorystore.rs index c0c60456671..b773d819d94 100644 --- a/crates/matrix-sdk-crypto/src/store/memorystore.rs +++ b/crates/matrix-sdk-crypto/src/store/memorystore.rs @@ -194,7 +194,8 @@ impl MemoryStore { type Result = std::result::Result; -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl CryptoStore for MemoryStore { type Error = Infallible; diff --git a/crates/matrix-sdk-crypto/src/store/traits.rs b/crates/matrix-sdk-crypto/src/store/traits.rs index bc2b33e48fd..3031e33ef8d 100644 --- a/crates/matrix-sdk-crypto/src/store/traits.rs +++ b/crates/matrix-sdk-crypto/src/store/traits.rs @@ -15,6 +15,7 @@ use std::{collections::HashMap, fmt, sync::Arc}; use async_trait::async_trait; +use matrix_sdk_common::AsyncTraitDeps; use ruma::{ events::secret::request::SecretName, DeviceId, OwnedDeviceId, RoomId, TransactionId, UserId, }; @@ -36,8 +37,9 @@ use crate::{ /// Represents a store that the `OlmMachine` uses to store E2EE data (such as /// cryptographic keys). -#[async_trait] -pub trait CryptoStore: fmt::Debug + Send + Sync { +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] +pub trait CryptoStore: AsyncTraitDeps { /// The error type used by this crypto store. type Error: fmt::Debug + Into; @@ -367,7 +369,8 @@ impl fmt::Debug for EraseCryptoStoreError { } } -#[async_trait] +#[cfg_attr(target_arch = "wasm32", async_trait(?Send))] +#[cfg_attr(not(target_arch = "wasm32"), async_trait)] impl CryptoStore for EraseCryptoStoreError { type Error = CryptoStoreError;