@@ -110,16 +110,19 @@ macro_rules! build_rpc_trait {
110
110
$(
111
111
$( #[ doc=$m_doc: expr] ) *
112
112
#[ rpc( $( $t: tt) * ) ]
113
- fn $m_name: ident ( $( $p: tt) * ) -> $result: tt <$out: ty $( , $error: ty) * >;
113
+ fn $m_name: ident ( $( $p: tt ) * ) -> $result: tt <$out: ty $( , $error: ty) * >;
114
114
) *
115
115
}
116
116
) => {
117
117
$( #[ $t_attr] ) *
118
118
pub trait $name $( <$( $simple_generics , ) * $( $generics , ) * >) * : Sized + Send + Sync + ' static {
119
- $(
120
- $( #[ doc=$m_doc] ) *
121
- fn $m_name ( $( $p) * ) -> $result<$out $( , $error) * > ;
122
- ) *
119
+ build_rpc_trait!(
120
+ GENERATE_FUNCTIONS
121
+ $(
122
+ $( #[ doc=$m_doc] ) *
123
+ fn $m_name ( $( $p ) * ) -> $result <$out $( , $error) * >;
124
+ ) *
125
+ ) ;
123
126
124
127
/// Transform this into an `IoDelegate`, automatically wrapping
125
128
/// the parameters.
@@ -133,7 +136,7 @@ macro_rules! build_rpc_trait {
133
136
$(
134
137
build_rpc_trait!( WRAP del =>
135
138
( $( $t) * )
136
- fn $m_name ( $( $p ) * ) -> $result <$out $( , $error) * >
139
+ fn $m_name ( $( $p ) * ) -> $result <$out $( , $error) * >
137
140
) ;
138
141
) *
139
142
del
@@ -155,7 +158,7 @@ macro_rules! build_rpc_trait {
155
158
$(
156
159
$( #[ doc=$m_doc: expr ] ) *
157
160
#[ rpc( $( $t: tt) * ) ]
158
- fn $m_name: ident ( $( $p: tt) * ) -> $result: tt <$out: ty $( , $error_std: ty) * >;
161
+ fn $m_name: ident ( $( $p: tt ) * ) -> $result: tt <$out: ty $( , $error_std: ty) * >;
159
162
) *
160
163
161
164
$(
@@ -178,10 +181,12 @@ macro_rules! build_rpc_trait {
178
181
$( $sub_name ) *
179
182
) ;
180
183
181
- $(
182
- $( #[ doc=$m_doc] ) *
183
- fn $m_name ( $( $p) * ) -> $result <$out $( , $error_std) * >;
184
- ) *
184
+ build_rpc_trait!( GENERATE_FUNCTIONS
185
+ $(
186
+ $( #[ doc=$m_doc] ) *
187
+ fn $m_name ( $( $p ) * ) -> $result <$out $( , $error_std) * >;
188
+ ) *
189
+ ) ;
185
190
186
191
$(
187
192
$( #[ doc=$sub_doc] ) *
@@ -202,7 +207,7 @@ macro_rules! build_rpc_trait {
202
207
$(
203
208
build_rpc_trait!( WRAP del =>
204
209
( $( $t) * )
205
- fn $m_name ( $( $p ) * ) -> $result <$out $( , $error_std) * >
210
+ fn $m_name ( $( $p ) * ) -> $result <$out $( , $error_std) * >
206
211
) ;
207
212
) *
208
213
$(
@@ -219,17 +224,15 @@ macro_rules! build_rpc_trait {
219
224
}
220
225
} ;
221
226
222
- ( WRAP $del: expr =>
223
- ( name = $name: expr $( , alias = [ $( $alias: expr, ) + ] ) * )
224
- fn $method: ident ( & self $( , $param: ty) * ) -> $result: tt <$out: ty $( , $error: ty) * >
227
+ ( GENERATE_FUNCTIONS
228
+ $(
229
+ $( #[ doc=$m_doc: expr] ) *
230
+ fn $m_name: ident ( & self $( , $p: ty) * ) -> $result: ty;
231
+ ) *
225
232
) => {
226
- $del. add_method( $name, move |base, params| {
227
- $crate:: WrapAsync :: wrap_rpc( & ( Self :: $method as fn ( & _ $( , $param) * ) -> $result <$out $( , $error) * >) , base, params)
228
- } ) ;
229
233
$(
230
- $(
231
- $del. add_alias( $alias, $name) ;
232
- ) +
234
+ $( #[ doc=$m_doc] ) *
235
+ fn $m_name ( & self $( , _: $p ) * ) -> $result;
233
236
) *
234
237
} ;
235
238
@@ -284,6 +287,20 @@ macro_rules! build_rpc_trait {
284
287
) *
285
288
) *
286
289
} ;
290
+
291
+ ( WRAP $del: expr =>
292
+ ( name = $name: expr $( , alias = [ $( $alias: expr, ) + ] ) * )
293
+ fn $method: ident ( & self $( , $param: ty) * ) -> $result: tt <$out: ty $( , $error: ty) * >
294
+ ) => {
295
+ $del. add_method( $name, move |base, params| {
296
+ $crate:: WrapAsync :: wrap_rpc( & ( Self :: $method as fn ( & _ $( , $param) * ) -> $result <$out $( , $error) * >) , base, params)
297
+ } ) ;
298
+ $(
299
+ $(
300
+ $del. add_alias( $alias, $name) ;
301
+ ) +
302
+ ) *
303
+ } ;
287
304
}
288
305
289
306
/// A wrapper type without an implementation of `Deserialize`
0 commit comments