Fix self references in GenericClient

This commit is contained in:
dvic 2020-01-27 11:14:27 +01:00
parent afc9b2835d
commit 1ea8b7b2d4
No known key found for this signature in database
GPG Key ID: FF6528EC6B2AA032
3 changed files with 9 additions and 21 deletions

View File

@ -507,7 +507,7 @@ impl Client {
#[async_trait]
impl GenericClient for Client {
/// Like `Client::execute`.
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
where
T: ?Sized + ToStatement + Sync + Send,
{
@ -525,11 +525,7 @@ impl GenericClient for Client {
}
/// Like `Client::query`.
async fn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, 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<Statement, Error> {
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
self.prepare(query).await
}

View File

@ -7,7 +7,7 @@ use async_trait::async_trait;
#[async_trait]
pub trait GenericClient {
/// Like `Client::execute`.
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
where
T: ?Sized + ToStatement + Sync + Send;
@ -19,11 +19,7 @@ pub trait GenericClient {
I::IntoIter: ExactSizeIterator;
/// Like `Client::query`.
async fn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, 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<Statement, Error>;
async fn prepare(&self, query: &str) -> Result<Statement, Error>;
/// Like `Client::prepare_typed`.
async fn prepare_typed(

View File

@ -290,7 +290,7 @@ impl<'a> Transaction<'a> {
#[async_trait]
impl crate::GenericClient for Transaction<'_> {
/// Like `Transaction::execute`.
async fn execute<T>(&mut self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
async fn execute<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<u64, Error>
where
T: ?Sized + ToStatement + Sync + Send,
{
@ -308,11 +308,7 @@ impl crate::GenericClient for Transaction<'_> {
}
/// Like `Transaction::query`.
async fn query<T>(
&mut self,
query: &T,
params: &[&(dyn ToSql + Sync)],
) -> Result<Vec<Row>, Error>
async fn query<T>(&self, query: &T, params: &[&(dyn ToSql + Sync)]) -> Result<Vec<Row>, 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<Statement, Error> {
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
self.prepare(query).await
}