@@ -12,9 +12,6 @@ mod private {
12
12
/// This trait is "sealed", and cannot be implemented outside of this crate.
13
13
#[ async_trait]
14
14
pub trait GenericClient : private:: Sealed {
15
- /// Get a reference to the underlying `Client`
16
- fn client ( & self ) -> & Client ;
17
-
18
15
/// Like `Client::execute`.
19
16
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
20
17
where
@@ -71,16 +68,15 @@ pub trait GenericClient: private::Sealed {
71
68
72
69
/// Like `Client::transaction`.
73
70
async fn transaction ( & mut self ) -> Result < Transaction < ' _ > , Error > ;
71
+
72
+ /// Returns a reference to the underlying `Client`.
73
+ fn client ( & self ) -> & Client ;
74
74
}
75
75
76
76
impl private:: Sealed for Client { }
77
77
78
78
#[ async_trait]
79
79
impl GenericClient for Client {
80
- fn client ( & self ) -> & Client {
81
- self
82
- }
83
-
84
80
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
85
81
where
86
82
T : ?Sized + ToStatement + Sync + Send ,
@@ -152,17 +148,17 @@ impl GenericClient for Client {
152
148
async fn transaction ( & mut self ) -> Result < Transaction < ' _ > , Error > {
153
149
self . transaction ( ) . await
154
150
}
151
+
152
+ fn client ( & self ) -> & Client {
153
+ self
154
+ }
155
155
}
156
156
157
157
impl private:: Sealed for Transaction < ' _ > { }
158
158
159
159
#[ async_trait]
160
160
#[ allow( clippy:: needless_lifetimes) ]
161
161
impl GenericClient for Transaction < ' _ > {
162
- fn client ( & self ) -> & Client {
163
- self . client ( )
164
- }
165
-
166
162
async fn execute < T > ( & self , query : & T , params : & [ & ( dyn ToSql + Sync ) ] ) -> Result < u64 , Error >
167
163
where
168
164
T : ?Sized + ToStatement + Sync + Send ,
@@ -235,4 +231,8 @@ impl GenericClient for Transaction<'_> {
235
231
async fn transaction < ' a > ( & ' a mut self ) -> Result < Transaction < ' a > , Error > {
236
232
self . transaction ( ) . await
237
233
}
234
+
235
+ fn client ( & self ) -> & Client {
236
+ self . client ( )
237
+ }
238
238
}
0 commit comments