@@ -209,9 +209,7 @@ macro_rules! __inner_declare_class {
209
209
@extract_sel
210
210
$( #[ $( $m) * ] ) *
211
211
} ,
212
- $crate:: __inner_declare_class! {
213
- @cast_extern_fn
214
- @$name
212
+ Self :: $name as $crate:: __extern_fn_ptr! {
215
213
$( $builder_args) *
216
214
} ,
217
215
) ;
@@ -231,187 +229,11 @@ macro_rules! __inner_declare_class {
231
229
@extract_sel
232
230
$( #[ $( $m) * ] ) *
233
231
} ,
234
- $crate:: __inner_declare_class! {
235
- @cast_extern_fn
236
- @$name
232
+ Self :: $name as $crate:: __extern_fn_ptr! {
237
233
$( $builder_args) *
238
234
} ,
239
235
) ;
240
236
} ;
241
-
242
- // Create the `as extern "C" fn(...) -> _` cast
243
- //
244
- // TODO: Investigate if there's a better way of doing this
245
- {
246
- @cast_extern_fn
247
- @$name: ident
248
-
249
- $( , ) ?
250
- } => {
251
- Self :: $name as extern "C" fn ( _, _) -> _
252
- } ;
253
- {
254
- @cast_extern_fn
255
- @$name: ident
256
-
257
- $( $param1: ident) ? $( _) ?: $param1_ty: ty $( , ) ?
258
- } => {
259
- Self :: $name as extern "C" fn ( _, _, _) -> _
260
- } ;
261
- {
262
- @cast_extern_fn
263
- @$name: ident
264
-
265
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
266
- $( $param2: ident) ? $( _) ?: $param2_ty: ty $( , ) ?
267
- } => {
268
- Self :: $name as extern "C" fn ( _, _, _, _) -> _
269
- } ;
270
- {
271
- @cast_extern_fn
272
- @$name: ident
273
-
274
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
275
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
276
- $( $param3: ident) ? $( _) ?: $param3_ty: ty $( , ) ?
277
- } => {
278
- Self :: $name as extern "C" fn ( _, _, _, _, _) -> _
279
- } ;
280
- {
281
- @cast_extern_fn
282
- @$name: ident
283
-
284
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
285
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
286
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
287
- $( $param4: ident) ? $( _) ?: $param4_ty: ty $( , ) ?
288
- } => {
289
- Self :: $name as extern "C" fn ( _, _, _, _, _, _) -> _
290
- } ;
291
- {
292
- @cast_extern_fn
293
- @$name: ident
294
-
295
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
296
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
297
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
298
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
299
- $( $param5: ident) ? $( _) ?: $param5_ty: ty $( , ) ?
300
- } => {
301
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _) -> _
302
- } ;
303
- {
304
- @cast_extern_fn
305
- @$name: ident
306
-
307
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
308
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
309
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
310
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
311
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
312
- $( $param6: ident) ? $( _) ?: $param6_ty: ty $( , ) ?
313
- } => {
314
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _) -> _
315
- } ;
316
- {
317
- @cast_extern_fn
318
- @$name: ident
319
-
320
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
321
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
322
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
323
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
324
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
325
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
326
- $( $param7: ident) ? $( _) ?: $param7_ty: ty $( , ) ?
327
- } => {
328
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _) -> _
329
- } ;
330
- {
331
- @cast_extern_fn
332
- @$name: ident
333
-
334
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
335
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
336
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
337
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
338
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
339
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
340
- $( $param7: ident) ? $( _) ?: $param7_ty: ty,
341
- $( $param8: ident) ? $( _) ?: $param8_ty: ty $( , ) ?
342
- } => {
343
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _, _) -> _
344
- } ;
345
- {
346
- @cast_extern_fn
347
- @$name: ident
348
-
349
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
350
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
351
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
352
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
353
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
354
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
355
- $( $param7: ident) ? $( _) ?: $param7_ty: ty,
356
- $( $param8: ident) ? $( _) ?: $param8_ty: ty,
357
- $( $param9: ident) ? $( _) ?: $param9_ty: ty $( , ) ?
358
- } => {
359
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _) -> _
360
- } ;
361
- {
362
- @cast_extern_fn
363
- @$name: ident
364
-
365
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
366
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
367
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
368
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
369
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
370
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
371
- $( $param7: ident) ? $( _) ?: $param7_ty: ty,
372
- $( $param8: ident) ? $( _) ?: $param8_ty: ty,
373
- $( $param9: ident) ? $( _) ?: $param9_ty: ty,
374
- $( $param10: ident) ? $( _) ?: $param10_ty: ty $( , ) ?
375
- } => {
376
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _) -> _
377
- } ;
378
- {
379
- @cast_extern_fn
380
- @$name: ident
381
-
382
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
383
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
384
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
385
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
386
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
387
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
388
- $( $param7: ident) ? $( _) ?: $param7_ty: ty,
389
- $( $param8: ident) ? $( _) ?: $param8_ty: ty,
390
- $( $param9: ident) ? $( _) ?: $param9_ty: ty,
391
- $( $param10: ident) ? $( _) ?: $param10_ty: ty,
392
- $( $param11: ident) ? $( _) ?: $param11_ty: ty $( , ) ?
393
- } => {
394
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
395
- } ;
396
- {
397
- @cast_extern_fn
398
- @$name: ident
399
-
400
- $( $param1: ident) ? $( _) ?: $param1_ty: ty,
401
- $( $param2: ident) ? $( _) ?: $param2_ty: ty,
402
- $( $param3: ident) ? $( _) ?: $param3_ty: ty,
403
- $( $param4: ident) ? $( _) ?: $param4_ty: ty,
404
- $( $param5: ident) ? $( _) ?: $param5_ty: ty,
405
- $( $param6: ident) ? $( _) ?: $param6_ty: ty,
406
- $( $param7: ident) ? $( _) ?: $param7_ty: ty,
407
- $( $param8: ident) ? $( _) ?: $param8_ty: ty,
408
- $( $param9: ident) ? $( _) ?: $param9_ty: ty,
409
- $( $param10: ident) ? $( _) ?: $param10_ty: ty,
410
- $( $param11: ident) ? $( _) ?: $param11_ty: ty,
411
- $( $param12: ident) ? $( _) ?: $param12_ty: ty $( , ) ?
412
- } => {
413
- Self :: $name as extern "C" fn ( _, _, _, _, _, _, _, _, _, _, _, _, _, _) -> _
414
- } ;
415
237
}
416
238
417
239
/// Declare a new Objective-C class.
0 commit comments