@@ -1379,6 +1379,20 @@ where
1379
1379
}
1380
1380
}
1381
1381
1382
+ // For functions that accept no arguments. Implemented explicitly instead of via
1383
+ // macro below to avoid unused warnings.
1384
+ impl FromArgs for ( ) {
1385
+ fn from_args < I > (
1386
+ _vm : & mut VirtualMachine ,
1387
+ _args : & mut iter:: Peekable < I > ,
1388
+ ) -> Result < Self , ArgumentError >
1389
+ where
1390
+ I : Iterator < Item = PyArg > ,
1391
+ {
1392
+ Ok ( ( ) )
1393
+ }
1394
+ }
1395
+
1382
1396
// A tuple of types that each implement `FromArgs` represents a sequence of
1383
1397
// arguments that can be bound and passed to a built-in function.
1384
1398
//
@@ -1465,25 +1479,26 @@ impl IntoPyNativeFunc<PyFuncArgs, PyResult> for PyNativeFunc {
1465
1479
//
1466
1480
// Note that this could be done without a macro - it is simply to avoid repetition.
1467
1481
macro_rules! into_py_native_func_tuple {
1468
- ( $( ( $n: tt, $T: ident) ) ,+ ) => {
1469
- impl <F , $( $T, ) + R > IntoPyNativeFunc <( $( $T, ) + ) , R > for F
1482
+ ( $( ( $n: tt, $T: ident) ) ,* ) => {
1483
+ impl <F , $( $T, ) * R > IntoPyNativeFunc <( $( $T, ) * ) , R > for F
1470
1484
where
1471
- F : Fn ( $( $T, ) + & mut VirtualMachine ) -> R + ' static ,
1472
- $( $T: FromArgs , ) +
1473
- ( $( $T, ) + ) : FromArgs ,
1485
+ F : Fn ( $( $T, ) * & mut VirtualMachine ) -> R + ' static ,
1486
+ $( $T: FromArgs , ) *
1487
+ ( $( $T, ) * ) : FromArgs ,
1474
1488
R : IntoPyObject ,
1475
1489
{
1476
1490
fn into_func( self ) -> PyNativeFunc {
1477
1491
Box :: new( move |vm, args| {
1478
- let ( $( $n, ) + ) = args. bind:: <( $( $T, ) + ) >( vm) ?;
1492
+ let ( $( $n, ) * ) = args. bind:: <( $( $T, ) * ) >( vm) ?;
1479
1493
1480
- ( self ) ( $( $n, ) + vm) . into_pyobject( & vm. ctx)
1494
+ ( self ) ( $( $n, ) * vm) . into_pyobject( & vm. ctx)
1481
1495
} )
1482
1496
}
1483
1497
}
1484
1498
} ;
1485
1499
}
1486
1500
1501
+ into_py_native_func_tuple ! ( ) ;
1487
1502
into_py_native_func_tuple ! ( ( a, A ) ) ;
1488
1503
into_py_native_func_tuple ! ( ( a, A ) , ( b, B ) ) ;
1489
1504
into_py_native_func_tuple ! ( ( a, A ) , ( b, B ) , ( c, C ) ) ;
0 commit comments