Commit Graph

5 Commits

Author SHA1 Message Date
Daniel Grunwald a23b5b5910 Add parameter extraction support to `py_fn!` and `py_method!`.
These macros now support specifying an argument list:
`py_fn!(myfn(myarg: i32))`
will expect `myfn` to be a function with the signature:
`fn myfn<'p>(py: Python<'p>, myarg: i32) -> PyResult<'p, _>`

It can called from python as `myfn(1)`
or using keyword arguments: `myfn(myarg=1)`.

If no parameter list is specified (`py_fn!(myfn)`), the expected signature
now includes the keyword arguments:
`fn run<'p>(py: Python<'p>, args: &PyTuple<'p>, kwargs: Option<&PyDict<'p>>)`

Due to the additional `kwargs` argument, this is a [breaking-change].
2015-08-03 00:06:15 +02:00
Daniel Grunwald 5c74f55862 Change `py_func!(py, f)` to `py_fn(f)`. 2015-06-25 00:02:56 +02:00
Daniel Grunwald 8c8779e3fb py_module_initializer! for python 3 2015-05-24 20:06:08 +02:00
Daniel Grunwald 5a303789b9 Don't export cstr! macro 2015-04-18 22:20:19 +02:00
Daniel Grunwald f8e24a870c Add support for exposing rust functions to python 2015-04-18 20:17:25 +02:00