Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt out of Send for wasm32 #174

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ pub use self::transaction_manager::{AnsiTransactionManager, TransactionManager};
/// Perform simple operations on a backend.
///
/// You should likely use [`AsyncConnection`] instead.
#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait SimpleAsyncConnection {
/// Execute multiple SQL statements within the same string.
///
Expand All @@ -129,7 +130,8 @@ pub trait SimpleAsyncConnection {
/// This trait represents a n async database connection. It can be used to query the database through
/// the query dsl provided by diesel, custom extensions or raw sql queries. It essentially mirrors
/// the sync diesel [`Connection`](diesel::connection::Connection) implementation
#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait AsyncConnection: SimpleAsyncConnection + Sized + Send {
/// The future returned by `AsyncConnection::execute`
type ExecuteFuture<'conn, 'query>: Future<Output = QueryResult<usize>> + Send;
Expand Down
1 change: 1 addition & 0 deletions src/pooled_connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ where
}
}

#[allow(dead_code)]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't touched this part of the code but CI for rust beta doesn't pass w/o this. LMK if you want me to revert

#[derive(diesel::query_builder::QueryId)]
struct CheckConnectionQuery;

Expand Down
6 changes: 4 additions & 2 deletions src/run_query_dsl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ impl<T, Conn> RunQueryDsl<Conn> for T {}
/// # Ok(())
/// # }
/// ```
#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait SaveChangesDsl<Conn> {
/// See the trait documentation
async fn save_changes<T>(self, connection: &mut Conn) -> QueryResult<T>
Expand All @@ -722,7 +723,8 @@ impl<T, Conn> SaveChangesDsl<Conn> for T where
/// For implementing this trait for a custom backend:
/// * The `Changes` generic parameter represents the changeset that should be stored
/// * The `Output` generic parameter represents the type of the response.
#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait UpdateAndFetchResults<Changes, Output>: AsyncConnection
where
Changes: diesel::prelude::Identifiable + HasTable,
Expand Down
3 changes: 2 additions & 1 deletion src/stmt_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type PrepareFuture<'a, F, S> = future::Either<
future::BoxFuture<'a, QueryResult<(MaybeCached<'a, S>, F)>>,
>;

#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait PrepareCallback<S, M>: Sized {
async fn prepare(
self,
Expand Down
6 changes: 4 additions & 2 deletions src/transaction_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::AsyncConnection;
///
/// You will not need to interact with this trait, unless you are writing an
/// implementation of [`AsyncConnection`].
#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
pub trait TransactionManager<Conn: AsyncConnection>: Send {
/// Data stored as part of the connection implementation
/// to track the current transaction state of a connection
Expand Down Expand Up @@ -287,7 +288,8 @@ impl AnsiTransactionManager {
}
}

#[async_trait::async_trait]
#[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)]
impl<Conn> TransactionManager<Conn> for AnsiTransactionManager
where
Conn: AsyncConnection<TransactionManager = Self>,
Expand Down
Loading