diff --git a/tokio-postgres/src/client.rs b/tokio-postgres/src/client.rs index f87e11ba..96e724d4 100644 --- a/tokio-postgres/src/client.rs +++ b/tokio-postgres/src/client.rs @@ -507,7 +507,7 @@ impl Client { #[async_trait] impl GenericClient for Client { /// Like `Client::execute`. - async fn execute(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result + async fn execute(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result where T: ?Sized + ToStatement + Sync + Send, { @@ -525,11 +525,7 @@ impl GenericClient for Client { } /// Like `Client::query`. - async fn query( - &mut self, - query: &T, - params: &[&(dyn ToSql + Sync)], - ) -> Result, Error> + async fn query(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result, Error> where T: ?Sized + ToStatement + Sync + Send, { @@ -571,7 +567,7 @@ impl GenericClient for Client { } /// Like `Client::prepare`. - async fn prepare(&mut self, query: &str) -> Result { + async fn prepare(&self, query: &str) -> Result { self.prepare(query).await } diff --git a/tokio-postgres/src/generic_client.rs b/tokio-postgres/src/generic_client.rs index 53473737..cfbd83e9 100644 --- a/tokio-postgres/src/generic_client.rs +++ b/tokio-postgres/src/generic_client.rs @@ -7,7 +7,7 @@ use async_trait::async_trait; #[async_trait] pub trait GenericClient { /// Like `Client::execute`. - async fn execute(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result + async fn execute(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result where T: ?Sized + ToStatement + Sync + Send; @@ -19,11 +19,7 @@ pub trait GenericClient { I::IntoIter: ExactSizeIterator; /// Like `Client::query`. - async fn query( - &mut self, - query: &T, - params: &[&(dyn ToSql + Sync)], - ) -> Result, Error> + async fn query(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result, Error> where T: ?Sized + ToStatement + Sync + Send; @@ -53,7 +49,7 @@ pub trait GenericClient { I::IntoIter: ExactSizeIterator; /// Like `Client::prepare`. - async fn prepare(&mut self, query: &str) -> Result; + async fn prepare(&self, query: &str) -> Result; /// Like `Client::prepare_typed`. async fn prepare_typed( diff --git a/tokio-postgres/src/transaction.rs b/tokio-postgres/src/transaction.rs index b165cbed..6d02ec52 100644 --- a/tokio-postgres/src/transaction.rs +++ b/tokio-postgres/src/transaction.rs @@ -290,7 +290,7 @@ impl<'a> Transaction<'a> { #[async_trait] impl crate::GenericClient for Transaction<'_> { /// Like `Transaction::execute`. - async fn execute(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result + async fn execute(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result where T: ?Sized + ToStatement + Sync + Send, { @@ -308,11 +308,7 @@ impl crate::GenericClient for Transaction<'_> { } /// Like `Transaction::query`. - async fn query( - &mut self, - query: &T, - params: &[&(dyn ToSql + Sync)], - ) -> Result, Error> + async fn query(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result, Error> where T: ?Sized + ToStatement + Sync + Send, { @@ -354,7 +350,7 @@ impl crate::GenericClient for Transaction<'_> { } /// Like `Transaction::prepare`. - async fn prepare(&mut self, query: &str) -> Result { + async fn prepare(&self, query: &str) -> Result { self.prepare(query).await }