Skip to content

Commit

Permalink
Bound GenericClient with Sync to allow extension traits
Browse files Browse the repository at this point in the history
I ran into a problem where I could not create an extension trait based on `GenericClient` because awaiting futures returned by the `GenericClient` methods requires that `&self` be `Sync`. Both `Transaction` and `Client` are already sync, so this just makes that requirement explicit.
  • Loading branch information
rossdylan authored and bikeshedder committed Sep 6, 2023
1 parent fce728d commit 45c42bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion postgres/src/generic_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod private {
///
/// This trait is "sealed", and cannot be implemented outside of this crate.
#[async_trait]
pub trait GenericClient: private::Sealed {
pub trait GenericClient: Sync + private::Sealed {
/// Like `Client::execute`.
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
where
Expand Down

0 comments on commit 45c42bb

Please sign in to comment.