Skip to content

Commit

Permalink
Restore some marker traits that were needed still
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Salinas authored and Daniel Salinas committed Oct 13, 2024
1 parent 246d70e commit 88ba030
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
3 changes: 2 additions & 1 deletion crates/matrix-sdk-base/src/event_cache_store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use std::{fmt, sync::Arc};

use matrix_sdk_common::AsyncTraitDeps;
use async_trait::async_trait;
use ruma::MxcUri;

Expand All @@ -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<EventCacheStoreError>;

Expand Down
13 changes: 2 additions & 11 deletions crates/matrix-sdk-base/src/read_receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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<SyncTimelineEvent>;
}

/// 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<SyncTimelineEvent>;
Expand Down
3 changes: 2 additions & 1 deletion crates/matrix-sdk-base/src/store/memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
9 changes: 6 additions & 3 deletions crates/matrix-sdk-base/src/store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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<StoreError> + From<serde_json::Error>;

Expand Down Expand Up @@ -450,7 +452,8 @@ impl<T: fmt::Debug> fmt::Debug for EraseStateStoreError<T> {
}
}

#[async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl<T: StateStore> StateStore for EraseStateStoreError<T> {
type Error = StoreError;

Expand Down
3 changes: 2 additions & 1 deletion crates/matrix-sdk-crypto/src/store/memorystore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ impl MemoryStore {

type Result<T> = std::result::Result<T, Infallible>;

#[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;

Expand Down
9 changes: 6 additions & 3 deletions crates/matrix-sdk-crypto/src/store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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<CryptoStoreError>;

Expand Down Expand Up @@ -367,7 +369,8 @@ impl<T: fmt::Debug> fmt::Debug for EraseCryptoStoreError<T> {
}
}

#[async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl<T: CryptoStore> CryptoStore for EraseCryptoStoreError<T> {
type Error = CryptoStoreError;

Expand Down

0 comments on commit 88ba030

Please sign in to comment.