Skip to content

Commit 1ea8b7b

Browse files
committed
Fix self references in GenericClient
1 parent afc9b28 commit 1ea8b7b

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

tokio-postgres/src/client.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ impl Client {
507507
#[async_trait]
508508
impl GenericClient for Client {
509509
/// Like `Client::execute`.
510-
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
510+
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
511511
where
512512
T: ?Sized + ToStatement + Sync + Send,
513513
{
@@ -525,11 +525,7 @@ impl GenericClient for Client {
525525
}
526526

527527
/// Like `Client::query`.
528-
async fn query<T>(
529-
&mut self,
530-
query: &T,
531-
params: &[&(dyn ToSql + Sync)],
532-
) -> Result<Vec<Row>, Error>
528+
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, Error>
533529
where
534530
T: ?Sized + ToStatement + Sync + Send,
535531
{
@@ -571,7 +567,7 @@ impl GenericClient for Client {
571567
}
572568

573569
/// Like `Client::prepare`.
574-
async fn prepare(&mut self, query: &str) -> Result<Statement, Error> {
570+
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
575571
self.prepare(query).await
576572
}
577573

tokio-postgres/src/generic_client.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use async_trait::async_trait;
77
#[async_trait]
88
pub trait GenericClient {
99
/// Like `Client::execute`.
10-
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
10+
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
1111
where
1212
T: ?Sized + ToStatement + Sync + Send;
1313

@@ -19,11 +19,7 @@ pub trait GenericClient {
1919
I::IntoIter: ExactSizeIterator;
2020

2121
/// Like `Client::query`.
22-
async fn query<T>(
23-
&mut self,
24-
query: &T,
25-
params: &[&(dyn ToSql + Sync)],
26-
) -> Result<Vec<Row>, Error>
22+
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, Error>
2723
where
2824
T: ?Sized + ToStatement + Sync + Send;
2925

@@ -53,7 +49,7 @@ pub trait GenericClient {
5349
I::IntoIter: ExactSizeIterator;
5450

5551
/// Like `Client::prepare`.
56-
async fn prepare(&mut self, query: &str) -> Result<Statement, Error>;
52+
async fn prepare(&self, query: &str) -> Result<Statement, Error>;
5753

5854
/// Like `Client::prepare_typed`.
5955
async fn prepare_typed(

tokio-postgres/src/transaction.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl<'a> Transaction<'a> {
290290
#[async_trait]
291291
impl crate::GenericClient for Transaction<'_> {
292292
/// Like `Transaction::execute`.
293-
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
293+
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
294294
where
295295
T: ?Sized + ToStatement + Sync + Send,
296296
{
@@ -308,11 +308,7 @@ impl crate::GenericClient for Transaction<'_> {
308308
}
309309

310310
/// Like `Transaction::query`.
311-
async fn query<T>(
312-
&mut self,
313-
query: &T,
314-
params: &[&(dyn ToSql + Sync)],
315-
) -> Result<Vec<Row>, Error>
311+
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, Error>
316312
where
317313
T: ?Sized + ToStatement + Sync + Send,
318314
{
@@ -354,7 +350,7 @@ impl crate::GenericClient for Transaction<'_> {
354350
}
355351

356352
/// Like `Transaction::prepare`.
357-
async fn prepare(&mut self, query: &str) -> Result<Statement, Error> {
353+
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
358354
self.prepare(query).await
359355
}
360356

0 commit comments

Comments
 (0)