Commit Graph

126 Commits

Author SHA1 Message Date
konstin 314a4a2b3e Some more documentation work 2018-05-19 17:27:26 +02:00
konstin 63441a4b94 Fix ObjectProtocol usage 2018-05-14 22:44:30 +02:00
Martin Larralde 01b7b3feeb Fix link to organisation page in `Cargo.toml` manifests [ci skip] 2018-05-14 18:53:37 +02:00
Martin Larralde 8e4e446e32 Fix warning about unused import when adding a function to module 2018-05-14 18:13:07 +02:00
Martin Larralde 2607fe9fdc Fix unused `add_function` result in `#[pyfn]` expansion 2018-05-14 16:50:08 +02:00
Martin Larralde 37eff44308 Store argument names as `Ident` instead of `String` in `args::Argument` 2018-05-14 16:29:38 +02:00
Martin Larralde df89720e23 Remove uneeded imports from `py_class.rs` 2018-05-14 13:56:58 +02:00
Martin Larralde 580e50f727 Make `build_py_proto` and `build_py_methods` only accept `ImplItem` 2018-05-14 13:34:36 +02:00
Martin Larralde 758d30abbd Allow unused imports in `#[proto]` 2018-05-14 13:17:58 +02:00
Martin Larralde 269ddbdd59 Use `&T` instead of `&Box<T>` where applicable 2018-05-14 13:04:29 +02:00
Martin Larralde d5efc40445 Fix module init function name in `py2_init` 2018-05-14 03:19:29 +02:00
Martin Larralde d1ec82d4a7 Remove `attr_with_parentheses` from `utils.rs` 2018-05-14 01:56:25 +02:00
Martin Larralde ecadcef0c9 Fix `items` in `pyo3-derive-backed::args` test module 2018-05-14 01:49:12 +02:00
Martin Larralde d07c538779 Port `pyo3cls` to latest `syn` 2018-05-14 00:49:15 +02:00
Martin Larralde bf550c3c1f Make `process_functions_...` only accept `ItemFn` 2018-05-13 21:33:59 +02:00
Martin Larralde b43b481980 Merge #154 and #155 changed with `syn13` 2018-05-13 21:24:40 +02:00
konstin 858a124374 Merge master 2018-05-05 15:50:04 +02:00
konstin 15204bab56 Better way to add functions to modules 2018-05-02 19:26:54 +02:00
konstin 0880ac166c Merge master 2018-05-01 20:41:35 +02:00
konstin 6113428746 Allow defining functions outside of the module declarations
This commit consists of
 * a proc macro to convert rust functions into python functions (`#[function]`),
 * a macro to register a function in a module (`add_function_to_module!`)
 * Documenting both the old and the new way in the book
2018-04-30 23:17:09 +02:00
konstin 1c276105e5 Generate better code
This reduces the size of the generated code and elinates at least two of the Err => Err antipatterns
2018-04-12 23:20:35 +02:00
konstin 1c0eac2690 Minor changes 2018-04-09 00:00:20 +02:00
konstin ccbc73a385 Fix compilation on older nightlies 2018-04-08 00:43:49 +02:00
konstin 45bb09b3e8 Relax return type requirements
Allows returning essentially arbitrary types by wrapping them into a PyResult. This is done with a conversion trait that specializes for PyResult.
2018-04-06 17:22:09 +02:00
konstin ced4eb532c Expect the pyo3 crate to be in scope for the codegen
This allows using generated code from crates that do not directly depend on pyo3.

E.g.:

```rust
extern crate my_pyo3_wrapper;

use my_pyo3_wrapper::pyo3;

#[py::modinit(rust2py)]
fn init_mod(py: Python, m: &PyModule) -> PyResult<()> {
    // ...
    Ok(())
}
2018-04-05 13:39:07 +02:00
konstin e570c6b9b9 Move the codegen into its own crate
This makes the code generatioin reusable from third party crates.
2018-04-05 13:39:07 +02:00